Skip site navigation (1) Skip section navigation (2)

Re: pg_dump trouble

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: gauthier lawny <gauthier_lawny(at)yahoo(dot)fr>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: pg_dump trouble
Date: 2004-09-26 11:26:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Fri, Sep 24, 2004 at 02:33:59PM +0200, gauthier lawny wrote:
> I got 2 tables like
> create table mytable(idnop serial, other varchar,
> primary key (idnop));
> create table reftable(idnop integer references
> mytable, primary key (idnop));
> pgsql create implicitly a sequence to handle the idnop serial.
> I perfomed some insertions into the 2 tables, no problem.
> Afterthat I run pg_dump with -D option (insert into
> (colomn, ...) values (...);
> The trouble is when it dumps the sequence. Instead of
> dumping the current value (which is the last used for
> an insertion into mytable) it dumps the value 1.

What version of PostgreSQL are you using?  I tested this with 7.4.5
and 8.0.0beta2 and in both cases pg_dump used pg_catalog.setval()
to set the value of the sequence to the correct value.

> Obviously when I restore the data and I try to perform
> an other insertion into mytable it fails because of
> the  primary key violation.

Can you provide complete example that shows how we can duplicate
the problem?

Michael Fuhr

In response to

pgsql-admin by date

Next:From: Somasekhar BangaloreDate: 2004-09-27 07:02:46
Subject: How to read from a text file and populate the table
Previous:From: ATOLODate: 2004-09-25 06:27:53
Subject: Re: Linux Distributions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group