From: Michael Fuhr <mike@fuhr.org>
To: gauthier lawny <gauthier_lawny@yahoo.fr>
Cc: pgsql-admin@postgresql.org
Subject: Re: pg_dump trouble
Date: Sun, 26 Sep 2004 05:26:11 -0600
Message-ID: <20040926112611.GA10133@winnie.fuhr.org> (raw)
In-Reply-To: <20040924123359.77475.qmail@web42007.mail.yahoo.com>
References: <20040924123359.77475.qmail@web42007.mail.yahoo.com>
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
http://www.fuhr.org/~mfuhr/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mike@fuhr.org, gauthier_lawny@yahoo.fr
Subject: Re: pg_dump trouble
In-Reply-To: <20040926112611.GA10133@winnie.fuhr.org>
References: <20040924123359.77475.qmail@web42007.mail.yahoo.com> <20040926112611.GA10133@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox