Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 27FD39FA197 for ; Tue, 28 Aug 2007 14:56:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 75674-06 for ; Tue, 28 Aug 2007 14:56:20 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 6F9039FA021 for ; Tue, 28 Aug 2007 14:56:21 -0300 (ADT) Received: (qmail invoked by alias); 28 Aug 2007 17:56:18 -0000 Received: from cm56-179-24.liwest.at (EHLO box) [86.56.179.24] by mail.gmx.net (mp056) with SMTP; 28 Aug 2007 19:56:18 +0200 X-Authenticated: #906534 X-Provags-ID: V01U2FsdGVkX1+xKiJECb6xblZkl7iqONRfqd4QS4SuOWXD7Q7rbZ fF//DIQh0KNq6n Received: from localhost (HELO [127.0.0.1]) [127.0.0.1] by box (86.56.179.24) with ESMTP (Classic Hamster Version 2.0 Build 2.0.0.1) ; Tue, 28 Aug 2007 18:08:55 +0200 Message-ID: <46D44897.10409@gmx.net> Date: Tue, 28 Aug 2007 18:08:55 +0200 From: KL User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: pg_dump object dump-order Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Posting-Agent: Hamster/2.0.0.1 X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/355 X-Sequence-Number: 26686 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.