Re: pg_dump fails to include sequences, leads to restore fail in any version - Mailing list pgsql-hackers

From Jeffrey Baker
Subject Re: pg_dump fails to include sequences, leads to restore fail in any version
Date
Msg-id fd145f7d0806171451l5f602b70la8986a4e6a1d690c@mail.gmail.com
Whole thread Raw
In response to Re: pg_dump fails to include sequences, leads to restore fail in any version  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: pg_dump fails to include sequences, leads to restore fail in any version
List pgsql-hackers
On Tue, Jun 17, 2008 at 2:43 PM, Alvaro Herrera <alvherre@commandprompt.com> wrote:
Jeffrey Baker escribió:
> On Tue, Jun 17, 2008 at 10:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> > "Jeffrey Baker" <jwbaker@gmail.com> writes:
> > > It is impossible to dump (with pg_dump -Ocx) and restore (with psql) a
> > > database which contains sequences in any of 8.1, 8.2, or 8.3:
> >
> > I should think we would have heard about it before now if such a
> > sweeping claim were true.
>
> Last time this problem came up, in August, you dismissed it somewhat
> rudely.  So perhaps the lack of reports is due more to perception than any
> other thing.

How did you set it up exactly?  I have no problem with this situation:

[snip]

The table was originally created this way:

CREATE TABLE transaction
(
        transaction_id          SERIAL PRIMARY KEY,
        buyer_account_id        INTEGER,
        seller_account_id       INTEGER,
        date                            DATE,
        item_id                         INTEGER,
        source                  TEXT
);

However, when dumped with pg_dump 8.1, it comes out this way:

CREATE TABLE "transaction" (
    transaction_id integer DEFAULT nextval('transaction_transaction_id_seq'::regclass) NOT NULL,
    buyer_account_id integer,
    seller_account_id integer,
    date date,
    item_id integer,
    source text
);

.. and the sequence does not get dumped with it.

-jwb

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_dump fails to include sequences, leads to restore fail in any version
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_dump fails to include sequences, leads to restore fail in any version