Re: [GENERAL] Sequences/defaults and pg_dump

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, nikolay(at)samokhvalov(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Sequences/defaults and pg_dump
Date: 2006-02-09 19:49:19
Message-ID: 200602091949.k19JnJf13285@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-02-09 19:55:17 Re: [GENERAL] Sequences/defaults and pg_dump
Previous Message Martijn van Oosterhout 2006-02-09 19:38:11 Re: What's faster?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-02-09 19:51:50 Re: User Defined Types in Java
Previous Message Mark Woodward 2006-02-09 19:49:08 Re: PostgreSQL 8.0.6 crash