Thread: Problem with pg_dump?

Problem with pg_dump?

From
"Ken Winter"
Date:
When I do a pg_dump from an 8.1 database (with options schema-only,
no-owner, and plain format), the dump file includes the following:

"
--
-- TOC entry 1623 (class 1259 OID 17618)
-- Dependencies: 5 1624
-- Name: transaction_transaction_id_seq; Type: SEQUENCE; Schema: public;
-- Owner: -
--

CREATE SEQUENCE transaction_transaction_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;

--
-- TOC entry 3403 (class 0 OID 0)
-- Dependencies: 1623
-- Name: transaction_transaction_id_seq; Type: SEQUENCE OWNED BY; Schema:
-- public; Owner: -
--
"

ALTER SEQUENCE transaction_transaction_id_seq OWNED BY
"transaction".transaction_id;

When I try to execute the dump script, the second command produces this
error:

"
ERROR:     syntax error at or near "OWNED"
"

as well it should, since the "OWNED" clause is not part of the ALTER
SEQUENCE syntax (see
http://www.postgresql.org/docs/8.1/static/sql-altersequence.html), which is:

"
ALTER SEQUENCE name [ INCREMENT [ BY ] increment ]
    [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
    [ RESTART [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
ALTER SEQUENCE name SET SCHEMA new_schema
"

(Full disclosure: I am actually getting this error when working through the
tool "PG Lightning Assistant" (see
http://www.amsoftwaredesign.com/lightning_admin.php).  I assume that PGLA
uses pg_dump to execute its "backup database" command.  However, if no one
else in PostgreSQL-land has encountered this problem, presumably it is a bug
in PGLA, not in pg_dump, and I will take my problem there.)

If it is a pg_dump bug, are there plans to fix it?  And, meanwhile, any
workarounds other than manually editing the pg_dump DDL file?

~ TIA
~ Ken


Re: Problem with pg_dump?

From
Tom Lane
Date:
"Ken Winter" <ken@sunward.org> writes:
> When I do a pg_dump from an 8.1 database (with options schema-only,
> no-owner, and plain format), the dump file includes the following:

> ALTER SEQUENCE transaction_transaction_id_seq OWNED BY
> "transaction".transaction_id;

Don't use 8.2 pg_dump if you are intending to reload the output into
8.1.  In general, pg_dump's output is not promised to be backward
compatible with older server versions.

> (Full disclosure: I am actually getting this error when working through the
> tool "PG Lightning Assistant" (see
> http://www.amsoftwaredesign.com/lightning_admin.php).

There are some "helpful" tools that seem not to be aware that pg_dump
and server versions are closely linked.

            regards, tom lane

Re: Problem with pg_dump?

From
"Ken Winter"
Date:
Everything I'm doing involves only 8.1.  I don't have any 8.2 instances at
all...

Oops, just I just got a message from my tool's developer that the tool uses
the 8.2 pg_dump no matter what actual PostgreSQL version it's working on.
Sigh.

~ Thanks
~ Ken



> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of Tom Lane
> Sent: Friday, January 04, 2008 3:35 PM
> To: Ken Winter
> Cc: PostgreSQL pg-general List
> Subject: Re: [GENERAL] Problem with pg_dump?
>
> "Ken Winter" <ken@sunward.org> writes:
> > When I do a pg_dump from an 8.1 database (with options schema-only,
> > no-owner, and plain format), the dump file includes the following:
>
> > ALTER SEQUENCE transaction_transaction_id_seq OWNED BY
> > "transaction".transaction_id;
>
> Don't use 8.2 pg_dump if you are intending to reload the output into
> 8.1.  In general, pg_dump's output is not promised to be backward
> compatible with older server versions.
>
> > (Full disclosure: I am actually getting this error when working through
> the
> > tool "PG Lightning Assistant" (see
> > http://www.amsoftwaredesign.com/lightning_admin.php).
>
> There are some "helpful" tools that seem not to be aware that pg_dump
> and server versions are closely linked.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq