Re: Is a SERIAL column a "black box", or not? - Mailing list pgsql-hackers

From Svenne Krap
Subject Re: Is a SERIAL column a "black box", or not?
Date
Msg-id 4454872A.7030004@krap.dk
Whole thread Raw
In response to Is a SERIAL column a "black box", or not?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Is a SERIAL column a "black box", or not?  ("Jim C. Nasby" <jnasby@pervasive.com>)
List 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.

Svenne

pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: Is a SERIAL column a "black box", or not?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Is a SERIAL column a "black box", or not?