Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E597CB5D91F for ; Wed, 27 Jul 2011 04:18:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 35953-05 for ; Wed, 27 Jul 2011 07:18:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D96BEB5D800 for ; Wed, 27 Jul 2011 04:18:27 -0300 (ADT) 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 p6R3REEx023792; Tue, 26 Jul 2011 23:27:15 -0400 (EDT) To: Julian Mehnle cc: pgsql-bugs@postgresql.org Subject: Re: pg_restore silently chokes on object comments/descriptions ending in a backslash In-reply-to: <201107270042.22427.julian@mehnle.net> References: <201107270042.22427.julian@mehnle.net> Comments: In-reply-to Julian Mehnle message dated "Wed, 27 Jul 2011 00:42:18 -0000" Date: Tue, 26 Jul 2011 23:27:14 -0400 Message-ID: <23791.1311737234@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.093 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.193 X-Spam-Level: X-Archive-Number: 201107/185 X-Sequence-Number: 30797 Julian Mehnle writes: > If the comment/description of a database object (table, function, etc.) > ends in a backslash (which generally works fine otherwise), then > pg_restore is unable to completely restore a custom-format dump of the > schema. Reproduced here against HEAD. The problem seems to be that pg_backup_db.c's _sendSQLLine() contains a mini SQL lexer that is not cognizant of standard_conforming_strings. Not sure about a simple fix, and I rather wonder if we shouldn't try to remove that code entirely instead of "fix" it. As a temporary workaround, the SQL text file that pg_restore produces by default seems to be valid, so you could pipe that into psql. regards, tom lane