X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4DF128B9B9A for ; Wed, 2 Feb 2005 20:01:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39531-04 for ; Wed, 2 Feb 2005 20:00:55 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id AC0438B9B30 for ; Wed, 2 Feb 2005 20:00:56 +0000 (GMT) Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j12K0tgf022397 for ; Wed, 2 Feb 2005 12:00:56 -0800 Message-ID: <42013187.7040806@commandprompt.com> Date: Wed, 02 Feb 2005 12:01:11 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL-development Subject: pg_dump bug in 7.3.9 with sequences Content-Type: multipart/mixed; boundary="------------060204050108010509060109" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/89 X-Sequence-Number: 63917 This is a multi-part message in MIME format. --------------060204050108010509060109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, Ran into this little gem with a customer today: This works: create table foo (foo int not null, bar text); create sequence foo_seq; alter table foo alter column foo set default nextval('foo_seq'); pg_dump will correctly dump the table: CREATE TABLE foo ( foo integer DEFAULT nextval('foo_seq'::text) NOT NULL, bar text ); -- -- TOC entry 3 (OID 107565218) -- Name: foo_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE foo_seq START 1 INCREMENT 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1; However if you do the following: create table foo (foo serial not null, bar text); create sequence foo_seq; alter table foo alter column foo set default nextval('foo_seq'); pg_dump will give you the following: CREATE TABLE foo ( foo serial NOT NULL, bar text ); -- -- TOC entry 3 (OID 107566148) -- Name: foo_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE foo_seq START 1 INCREMENT 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1; Which is wrong because we want the column foo to use a default of foo_seq not foo_foo_seq. Sincerely, Joshua D. Drake -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL --------------060204050108010509060109 Content-Type: text/x-vcard; charset=utf-8; name="jd.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="jd.vcf" begin:vcard fn:Joshua Drake n:Drake;Joshua org:Command Prompt, Inc. adr:;;PO Box 215 ;Cascade Locks;OR;97014;US email;internet:jd@commandprompt.com title:Consultant tel;work:503-667-4564 tel;fax:503-210-0334 x-mozilla-html:FALSE url:http://www.commandprompt.com version:2.1 end:vcard --------------060204050108010509060109--