Re: Primary key data type: integer vs identity

From: Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Primary key data type: integer vs identity
Date: 2019-04-19 18:06:22
Message-ID: CACxu=vJetwFKSPNtB2n0JZdR2r=BaJQGtrbgz99JmTbZaXDqUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 19, 2019 at 10:55 AM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> When I created the database I set primary key data types as integer; for
> example:
>
> Column | Type | Collation | Nullable | Default
> --------------+-----------------------+-----------+----------+-------------
> org_id | integer | | not null |
> nextval('organizations_org_id_seq'::regclass)
>
> I probably should have used the serial type, but didn't.
>
> If it would be advisable for me to convert from integer to identity please
> point me to the appropriate work flow.
>
>
https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL

"The data types smallserial, serial and bigserial are not true types, but
merely a notational convenience for creating unique identifier columns"

so really there's no difference, what you have is fine.

-Michel

Reading the CREATE TABLE pages in the manual did not give me sufficient
> insights to appreciate the differences or indicate how to change the
> column's data type.
>
> Regards,
>
> Rich
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-04-19 18:12:04 Re: Primary key data type: integer vs identity
Previous Message Adrian Klaver 2019-04-19 18:05:09 Re: Primary key data type: integer vs identity