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

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Re: Is a SERIAL column a "black box", or not?
Дата
Msg-id 1146371536.839.119.camel@home
обсуждение исходный текст
Ответ на Re: Is a SERIAL column a "black box", or not?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Is a SERIAL column a "black box", or not?  (Thomas Hallgren <thomas@tada.se>)
Список 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 по дате отправления:

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: Is a SERIAL column a "black box", or not?
Следующее
От: Svenne Krap
Дата:
Сообщение: Re: Is a SERIAL column a "black box", or not?