Re: Weirdess when altering serial column type

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Weirdess when altering serial column type
Date: 2005-04-21 01:57:20
Message-ID: 42670880.7040905@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Any further thoughts on this?

Tom Lane wrote:
> Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
>
>>I presume they have to drop the default, then drop the sequence to get
>>rid of it.
>
>
> Hmm. Right at the moment I don't think you *can* get rid of it, short
> of dropping the column altogether.
>
> regression=# create table z(f1 serial);
> NOTICE: CREATE TABLE will create implicit sequence "z_f1_seq" for serial column "z.f1"
> CREATE TABLE
> regression=# drop sequence z_f1_seq;
> ERROR: cannot drop sequence z_f1_seq because table z column f1 requires it
> HINT: You may drop table z column f1 instead.
> regression=# alter table z alter f1 drop default;
> ALTER TABLE
> regression=# drop sequence z_f1_seq;
> ERROR: cannot drop sequence z_f1_seq because table z column f1 requires it
> HINT: You may drop table z column f1 instead.
>
> Possibly it would be better if the implicit dependency led from the
> sequence to the column default rather than directly to the column ...
> but I'm too tired to think of the possible consequences. I think we
> may have considered and rejected that idea ...
>
> regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2005-04-21 01:58:31 Re: Postgres: pg_hba.conf, md5, pg_shadow, encrypted passwords
Previous Message Christopher Kings-Lynne 2005-04-21 01:47:58 Re: [GENERAL] Idea for the statistics collector