Skip site navigation (1) Skip section navigation (2)

Re: Is a SERIAL column a "black box", or not?

From: Svenne Krap <svenne(at)krap(dot)dk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Is a SERIAL column a "black box", or not?
Date: 2006-04-30 09:45:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Tom Lane wrote:
> In short, I think there's a reasonably good case to be made for losing the
> hidden dependency and re-adopting the viewpoint that saying SERIAL is
> *exactly* the same as making a sequence and then making a default
> expression that uses the sequence.  Nothing behind the curtain.
I speak more as a user than a hacker, but I do still lurk here ;)

The way sequences are handled is imho one of the strongest features. The 
possiblity to query nextval is bordering on divine.

I have however stopped using serials for anything else than quick mockup 
examples. The work of defining the sequence itself and setting acl's is 
imho trivial compared to consistency.

I would actually suggest throwing a warning, that sequences are the 
proper way of doing it when people use serials - maybe even mark 
serial-types as obsolete in the docs.

I strongly subscribe to the principle of least astonishment, and that 
means either pure sequences, a mysqlesqe auto_increment or both - but I 
fail to see, how the "macro"thing serial will ever work that way. It 
goes without saying, that I dislike auto_increment.


In response to


pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2006-04-30 10:28:50
Subject: Re: Is a SERIAL column a "black box", or not?
Previous:From: Magnus HaganderDate: 2006-04-30 09:06:05
Subject: Re: Is a SERIAL column a "black box", or not?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group