Joachim Wieland wrote:
> On Wed, Feb 08, 2006 at 10:57:20PM -0500, Bruce Momjian wrote:
> > > > > > TODO has:
>
> > > > > > * %Disallow changing default expression of a SERIAL column
>
> > > Sure, the "DROP SERIAL" I proposed would rather "change" the data type
> > > to int by dropping the default and would delete referring pg_depend entries.
> > > Read it more as a kind of "drop autoincrement functionality for this
> > > column".
>
> > > The problem I see (but you might see it differently) is that you can't drop
> > > this autoincrement stuff without also dropping the column once you forbid to
> > > change the default (yeah I know, changing the default is even worse and
> > > leaves you with incorrect dependencies).
>
> > I assume an ALTER COLUMN ... TYPE INTEGER would drop the SERIAL part.
>
> So far it doesn't because it doesn't know the difference between serial
> and int.
>
> What about this proposal for serial columns:
>
> - DROP DEFAULT drops serial and removes dependencies
> - SET DEFAULT forbidden, issues a hint to DROP DEFAULT first
>
>
> Is it also desired to convert an int column to a serial column?
I think the only sane solution is if a SERIAL column is changed to
INTEGER, the default and dependencies are removed. Do you want a TODO
for that?
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073