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

From Martijn van Oosterhout
Subject Re: Is a SERIAL column a "black box", or not?
Date
Msg-id 20060430102850.GB11912@svana.org
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?  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-hackers
On Sat, Apr 29, 2006 at 05:54:19PM -0400, Tom Lane wrote:
> In some recent activity on the patches list about responding to bug #2073,
> http://archives.postgresql.org/pgsql-bugs/2005-11/msg00303.php
> we've been discussing various possible tweaks to the behavior of dropping
> or modifying a serial column.  The hacks involved with SERIAL seem to me
> to be getting uglier and uglier, and I think it's time to take a step
> back and consider what we really want SERIAL to act like.
>
> It seems to me there are two basic philosophies at war here:

Since a real stumbling block with the macro approach seems to be the
granting of permissions maybe we should work on that problem. For
example, making SERIAL be a macro that expands to:

id integer default nextval(sequence) SECURITY DEFINER,

Which would mean that the default expression would be executed as the
creator of the table, thus obviating the need to grant explicit
permission to the sequence.

If you wanted to be tricky you could also add something like:

ON DROP CASCADE SEQUENCE sequence

This pretty much turns default expressions into actual objects. I don't
know if we want to do that. That would imply creating a CREATE DEFAULT
command, which is probably going too far (though it would be nice and
easy for pg_dump).

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

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