Re: error creating/setting sequence, pg_dump / pg_restore 8.1.5

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mason Hale" <masonhale(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: error creating/setting sequence, pg_dump / pg_restore 8.1.5
Date: 2007-04-14 16:19:35
Message-ID: 4776.1176567575@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Mason Hale" <masonhale(at)gmail(dot)com> writes:
> After running pg_dump to backup my database, and then running pg_restore to
> load the db (on a different server),
> I run into a problem with creating a sequence.

Hmm ... which sequence is entry.id actually referring to on the source
database? I suspect that it is linked to some differently-named
sequence like "entry_id_seq1" and the source's "entry_id_seq" is not
in truth doing anything (and, in particular, hasn't ever been advanced,
so when the restore script sets its value to 1 it's clobbering the other
sequence).

The methodology that pre-8.2 pg_dump uses for serial columns is
vulnerable to quite a number of problems if serial sequences don't have
the expected names, and this seems to be another one. 8.2 would be able
to handle the case, but in 8.1 the best advice is to drop the unused
sequence to avoid the name collision when SERIAL picks plain "entry_id_seq"
as the serial sequence's name upon reload.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anton Melser 2007-04-14 16:31:11 Re: recommendations for reducing mem usage on local dev machine
Previous Message Martijn van Oosterhout 2007-04-14 16:19:13 Re: indexing array columns