Re: Primary key data type: integer vs identity

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Primary key data type: integer vs identity
Date: 2019-04-19 19:35:00
Message-ID: CAD3a31UV8VxLWLFfDop4W_PUyMrKf6RGsQF7XkpdpV3Xc=sARw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 19, 2019 at 12:02 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 4/19/19 11:32 AM, Ken Tanzer wrote:
> > On Fri, Apr 19, 2019 at 11:20 AM Adrian Klaver
> > <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
> >
> > On 4/19/19 11:14 AM, Rich Shepard wrote:
> > > On Fri, 19 Apr 2019, Adrian Klaver wrote:
> > >
> > >> If it is working for you now I see no reason to switch.
> > >
> > > Adrian,
> > >
> > > It does work. I just learned about the SQL identity type and want
> > to learn
> > > when it's most appropriate to use. The databases I develop all
> > work with
> > > integers as primary keys and reading about the type didn't
> > clarify (for me)
> > > when it should be used.
> >
> > Mainly for folks that want cross database SQL compliance. It is not a
> > type so much as a way of specifying an auto-increment column.
> >
> >
> > It also sounds like it has advantages in terms of tying your sequence
> > directly to the column. If you drop a serial column, it doesn't drop
> > the sequence.
>
> A serial column will:
>
>
Thanks Adrian. You are as usual correct. (I had a bunch of tables created
by a function that I assumed were serial, but were not.) Identity columns
still seem tidier and more manageable. Can you tell if the function I
referenced would change the ownership or not?

Cheers,
Ken

--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-04-19 19:50:38 Re: Primary key data type: integer vs identity
Previous Message Adrian Klaver 2019-04-19 19:07:36 Re: Primary key data type: integer vs identity