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

From Rod Taylor
Subject Re: Is a SERIAL column a "black box", or not?
Date
Msg-id 1146371536.839.119.camel@home
Whole thread Raw
In response to Re: 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?
List pgsql-hackers
On Sat, 2006-04-29 at 23:15 -0400, Tom Lane wrote:
> Rod Taylor <pg@rbt.ca> writes:
> > Do both. Return SERIAL to being a macro and implement the SQL IDENTITY
> > construct as the black box version.
> 
> Doesn't SQL IDENTITY have a number of properties that are significantly
> different from serial/nextval?  I wasn't really volunteering to
> implement a large new feature to make this happen ;-)

Yes. Including a few really nice properties and a really ugly
workaround.

I didn't mean to imply that you should write it. I just meant that the
spec already has an automatic sequence generator which is black-box.

If SERIAL is going to be kept long term, then it should be the macro
version so it doesn't appear too duplicated.

> Also, I'm not sure how "black boxy" it can be without buying right back
> into the pg_dump problems.  pg_dump has to be able to see what's inside,
> I think.

Not sure which pg_dump problem you're referring to. A fully black box
generator would completely hide the column default and sequence. Pg_dump
and users can create and modify foreign keys without knowledge of the
trigger implementation, the same would be true here.

For the spec, the ugly workaround is "OVERRIDING SYSTEM VALUE" which
allows a table owner to override the ALWAYS GENERATE designation --
essentially the same as a trigger bypass switch for bulk data loads.

-- 



pgsql-hackers by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Is a SERIAL column a "black box", or not?
Next
From: Svenne Krap
Date:
Subject: Re: Is a SERIAL column a "black box", or not?