From: KL <zappa_lot@gmx.net>
To: pgsql-admin@postgresql.org
Subject: pg_dump object dump-order
Date: Tue, 28 Aug 2007 18:08:55 +0200
Message-ID: <46D44897.10409@gmx.net> (raw)
Greetings
I'm working with PostgreSQL for quite some time now
but only yesterday ran into a specific problem, as - so far -
I have always used customized backup/restore-scripts.
PROBLEM:
pg_dump seems to dump objects strictly alphabetically,
I presume. Hence a table "events" is always dumped
_before_ any sequence "events_id_seq" that is already
being referenced in the "create table"-statement for
table "events".
Example
CREATE TABLE event (
event_id integer DEFAULT nextval('event_id_seq'::text) NOT NULL,
.
.
.
);
ALTER TABLE public.event OWNER TO someuser;
--
-- Name: event_id_seq; Type: SEQUENCE; Schema: public; Owner: someuser
--
CREATE SEQUENCE event_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
This ordering results in an error upon importing the data
with "psql".
QUESTION:
Is there any solution/option/trick/secret/whatever
to make pg_dump export referenced objects _before_
they are being referenced?
Thanks in advance
PS:
The thing isn't really urgent, as I have my "custom"-scripts
anyway, but it could be convenient to just have pg_dump
and psql as reliable, "out-of-the-box"-fallback-options.
I searched the lists here and also googled the whole day,
but couldn't find anything appropriate. Should there be
a thread about this issue already, I'd like to apologize
in advance.
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: zappa_lot@gmx.net
Subject: Re: pg_dump object dump-order
In-Reply-To: <46D44897.10409@gmx.net>
* 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