Re: Dump serials as serial -- not a sequence - Mailing list pgsql-patches

From Rod Taylor
Subject Re: Dump serials as serial -- not a sequence
Date
Msg-id 1029616039.37296.27.camel@jester
Whole thread Raw
In response to Re: Dump serials as serial -- not a sequence  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
> The "serial primary key" hack in analyze.c does make that a bit ugly,
> but one simple answer is not to try to dump as a serial if there's a
> primary key on the column.



> A radical answer to that is to get rid of the implied UNIQUE constraint
> associated with SERIAL, thus making the combinations "serial unique" and
> "serial primary key" actually mean something.  I fear this won't fly :-(

My serials are almost always primary key's.  Wouldn't change anything in
that regard.

Docs suggest that UNIQUE and NOT NULL be applied to the column anyway.
http://www7.us.postgresql.org/users-lounge/docs/7.2/postgres/datatype.html#D

I'll see what others do.

> but it might be worth proposing.  If we have to maintain backwards
> compatibility, perhaps pg_dump could DROP the unique constraint just
> after making the table, and re-create it (possibly as a primary key
> rather than plain unique) when it makes indexes.

This seems really ugly, but would do the trick.




pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: updated lock listing patch
Next
From: Bruce Momjian
Date:
Subject: Re: updated lock listing patch