pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump trouble
2+ messages / 2 participants
[nested] [flat]

* pg_dump trouble
@ 2004-09-24 12:33  gauthier lawny <gauthier_lawny@yahoo.fr>
  0 siblings, 1 reply; 2+ messages in thread

From: gauthier lawny @ 2004-09-24 12:33 UTC (permalink / raw)
  To: pgsql-admin

Here is the trouble I encountered.

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.
Obviously when I restore the data and I try to perform
an other insertion into mytable it fails because of
the  primary key violation.

The presence of -D option doesn't have any effect on
the result.


	

	
		
Vous manquez d’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pg_dump trouble
@ 2004-09-26 11:26  Michael Fuhr <mike@fuhr.org>
  parent: gauthier lawny <gauthier_lawny@yahoo.fr>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Fuhr @ 2004-09-26 11:26 UTC (permalink / raw)
  To: gauthier lawny <gauthier_lawny@yahoo.fr>; +Cc: 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
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-09-26 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-24 12:33 pg_dump trouble gauthier lawny <gauthier_lawny@yahoo.fr>
2004-09-26 11:26 ` Michael Fuhr <mike@fuhr.org>

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