Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C139F152B1B9 for ; Tue, 15 Nov 2011 23:05:41 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 75782-03-6 for ; Wed, 16 Nov 2011 03:05:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 829BC57A908 for ; Tue, 15 Nov 2011 23:05:22 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RQVoM-0004Ai-61 for pgsql-bugs@postgresql.org; Wed, 16 Nov 2011 03:05:22 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pAG34w5j009674; Tue, 15 Nov 2011 22:04:58 -0500 (EST) To: Robert Haas cc: Heikki Linnakangas , Josh Berkus , Bruce Momjian , pgsql-bugs@postgresql.org Subject: Re: Cannot dump 8.4.8 database using later versions In-reply-to: References: <201111142313.pAENDep01085@momjian.us> <4EC1B5BD.9010901@agliodbs.com> <4EC23BFE.4000302@enterprisedb.com> Comments: In-reply-to Robert Haas message dated "Tue, 15 Nov 2011 20:28:05 -0500" Date: Tue, 15 Nov 2011 22:04:57 -0500 Message-ID: <9673.1321412697@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201111/110 X-Sequence-Number: 31705 Robert Haas writes: > On Tue, Nov 15, 2011 at 5:16 AM, Heikki Linnakangas > wrote: >> NEW used to be a reserved keyword, but it's not so in 9.0 anymore. So 9.0 >> pg_dump thinks it doesn't need to be quoted. > Why isn't it correct? It's correct to not quote it in pg_dump's output (since we make no promises that such output would load into a pre-9.0 server anyway). The problem is that it needs to be quoted in commands that pg_dump sends back to the 8.4 server. Example: psql (8.4.9) You are now connected to database "db84". db84=# create table "new"( f1 int, "new" text); ... pg_dump with newer pg_dump ... pg_dump: SQL command failed pg_dump: Error message from server: ERROR: syntax error at or near "new" LINE 1: COPY public.new (f1, new) TO stdout; ^ pg_dump: The command was: COPY public.new (f1, new) TO stdout; The least painful solution might be to always quote *every* identifier in commands sent to the source server, since we don't especially care how nice-looking those are. regards, tom lane