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

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
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 10:28:50
Message-ID: 20060430102850.GB11912@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Hallgren 2006-04-30 10:29:08 Re: Is a SERIAL column a "black box", or not?
Previous Message Svenne Krap 2006-04-30 09:45:14 Re: Is a SERIAL column a "black box", or not?