Re: How do I enabled Windows 10 to be able to run PSQL etc

From: Steve Midgley <science(at)misuse(dot)org>
To: Karen Goh <karenworld(at)yahoo(dot)com>
Cc: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: How do I enabled Windows 10 to be able to run PSQL etc
Date: 2019-09-12 12:22:18
Message-ID: CAJexoSLpKMS12WHe7T5Fujvw_umZ5vdt6v-cCxRQfObaHZYo7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Sep 12, 2019 at 1:17 PM Karen Goh <karenworld(at)yahoo(dot)com> wrote:

>
>
>
> Sent from Yahoo Mail for iPhone
> <https://overview.mail.yahoo.com/?.src=iOS>
>
> On Thursday, September 12, 2019, 8:07 PM, Steve Midgley <
> science(at)misuse(dot)org> wrote:
>
> On Thu, Sep 12, 2019 at 11:50 AM Karen Goh <karenworld(at)yahoo(dot)com> wrote:
>
> Anyway, now my problem is that i get a
>
> org.postgresql.util.PSQLException: ERROR: null value in column "parent_id"
> violates not-null constraint
>
> I'd like to know since I have already made parent_id a primary key, do I
> need to put a idenity as ALWAYS and increment by 1 ?
>
> cos another table I had used pgAdmin4 to define it as identity, ALWAYS,
> increment 1 and it works well....
>
> so what is the difference between identity and PRIMARY KEY ?
>
> and if I follow the other table definition for id and put in the ALWAYS,
> it will give me another problem...that the generated_id doesn't get
> inserted even though it should not
>
>
> Hi Karen,
>
> Please bottom post on this forum - it's uncommon these days, but the
> custom on this email list to post replies at the bottom of the email.
>
> Regarding your question about nulls and primary keys -- yes you want to
> define, where it makes sense, to use autoincrementing primary keys, if you
> want the system to manage your keys. Note that autoincrementing IDs, if
> exposed to the public via the web or similar, could create some security
> issues.
>
> Hi Steve,
>
> Sorry yahoo mail is giving me lots of problems in typing at the bottom -
> the convention.
>
> I would like to confirm how to make an ID in PostgreSQL auto increment
> like MySQL?
>
> And since I need to have generated key to be retrieved before inserting
> into the join table, if I don’t do it via web how can I do it then?
>
> But in many cases it makes a lot of sense to use them. To create a primary
> key that autoincrements, use the "serial" or "bigserial" datatype. Combined
> with a primary key (that enforces "not null" among other things), your
> create table would look like this:
>
> CREATE TABLE sample (
> id SERIAL PRIMARY KEY,);
>
> Why is my another table, without making the id serial it is auto-incrementing?
>
>
> I have not tested it, but I'd guess you should be able to alter a table that has an integer primary key and convert it to a serial. I hope that's helpful! Steve
>
>
Send us the "DDL" for your table and we might be able to help. PgAdmin4
should be able to give you the create table statement that would create the
table that is autoincrementing without a serial datatype that you can share
with us, and probably someone can answer that question. It is possible to
make fields autoincrement using other methods, iirc. Steve

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Iuri Sampaio 2019-09-12 23:17:06 Re: Looking for technical references on how to set up PostGIS/PostgreSQL for serving MapInfo Desktop application users
Previous Message Karen Goh 2019-09-12 12:17:34 Re: How do I enabled Windows 10 to be able to run PSQL etc