PostgreSQL: serial vs integer sequences?
Lou Picciano
loupicciano at comcast.net
Mon Mar 6 06:30:17 EST 2017
Hi Nick!
Absolutely no good reason not to use the serial pseudotype.
Really, what it gets you is a ticket to the sequence functionality in PostgreSQL, which does so much of the heavy lifting for you.
Beautiful, built-in stuff.
Check out the currval() and nextval() functions, and how these can make life so much easier!
Yes, that sound is me beating on the PostgreSQL 'drum' again... (!)
Lou Picciano
>
> On March 6, 2017 at 5:31 AM Nick Renders <omnis1 at arcict.com> wrote:
>
> Hi Everybody,
>
> We recently upgraded our Postgres server from v9.4 to v9.6 and
> exported/imported
> all our data in doing so. I noticed that all the columns of type serial
> have been
> converted to integer. The sequences are still in place, so I didn't
> think too much
> of it, but now that I need to create some new tables, I am wondering:
>
> Is there any reason NOT to use the serial type for sequence fields?
>
> Using integer fields for sequences seems so much clunkier.
>
> Cheers,
>
> Nick Renders
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
>
More information about the omnisdev-en
mailing list