Re: dump the database data - Mailing list pgsql-general

From Michael Fuhr
Subject Re: dump the database data
Date
Msg-id 20050708165229.GA86826@winnie.fuhr.org
Whole thread Raw
In response to dump the database data  (Tony Smith <quickcur@yahoo.com>)
List pgsql-general
On Fri, Jul 08, 2005 at 09:03:47AM -0700, Tony Smith wrote:
>
>    pg_dump -d ....

What's the complete command?

> In my dump file I found the insert statements
> something like:
>
>     INSERT into user values(5, "George", 1);
>     INSERT into user values(6, "Richard", 3);
>     INSERT into user values(7, "Pete", 6);
>
> I create the same tables in another database and run
> the above insert statement, the data was inserted, but
> the seq of user is not updated, it is still pointed to
> one. What is wrong?

The INSERT statements don't update the sequence because they provide
a value for the serial column (really an integer column), so the
DEFAULT expression (a call to nextval()) isn't used.  But somewhere
in the dump should be a SELECT statement that calls setval() to
update the sequence -- do you not see that?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: Douglas McNaught
Date:
Subject: Re: Why UPDATE gl SET gl.glnum = gl.glnum; cause error when UPDATE gl
Next
From: Mark Harrison
Date:
Subject: anybody used ERWin with pg?