Re: MySQL to Postgres question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: MySQL to Postgres question
Date: 2008-03-23 01:49:34
Message-ID: 26032.1206236974@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"James B. Byrne" <byrnejb(at)harte-lyne(dot)ca> writes:
> On: Fri, 21 Mar 2008 13:53:36 -0500, "Adam Rich" <adam(dot)r(at)sbcglobal(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Rich 2008-03-23 02:17:10 Re: MySQL to Postgres question
Previous Message Craig Ringer 2008-03-23 01:28:22 Re: --enable-thread-safety bug