Re: MySQL to Postgres question - Mailing list pgsql-general

From Tom Lane
Subject Re: MySQL to Postgres question
Date
Msg-id 26032.1206236974@sss.pgh.pa.us
Whole thread Raw
In response to Re: MySQL to Postgres question  ("James B. Byrne" <byrnejb@harte-lyne.ca>)
Responses Re: MySQL to Postgres question  ("Adam Rich" <adam.r@sbcglobal.net>)
List pgsql-general
"James B. Byrne" <byrnejb@harte-lyne.ca> writes:
> On: Fri, 21 Mar 2008 13:53:36 -0500, "Adam Rich" <adam.r@sbcglobal.net>
> wrote:
>> I'd like to point out that using pg_dump does in fact apply sequences
>> to columns after the fact. (at least in 8.3)  Columns lose their
>> "serial" designation after each backup/restore (and therefore during
>> version upgrades)

> Can someone expand upon this observation with respect to tables with surrogate
> primary keys generated by a sequence?

The short answer is that Adam's statement is wrong, or at least
misleading.  pg_dump does restore serial columns to the same state
they were in.  (This has little to do with whether the word "serial"
is used in the dump script, which is what he seems to be complaining
about.)

There are some corner cases involving altering either the name of the
serial column or the name of the associated sequence (but not both
to match) that a dump and reload wouldn't exactly reproduce in pre-8.2
versions.

            regards, tom lane

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: --enable-thread-safety bug
Next
From: "Adam Rich"
Date:
Subject: Re: MySQL to Postgres question