X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2D199DC81E for ; Thu, 2 Feb 2006 23:55:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61538-03 for ; Thu, 2 Feb 2006 23:55:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 2F49E9DC821 for ; Thu, 2 Feb 2006 23:55:16 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k133tNw00862; Thu, 2 Feb 2006 22:55:23 -0500 (EST) From: Bruce Momjian Message-Id: <200602030355.k133tNw00862@candle.pha.pa.us> Subject: Re: [BUGS] BUG #2171: Differences compiling plpgsql in ecpg In-Reply-To: <1138905401.5342.15.camel@swithin> To: Andrew Dunstan Date: Thu, 2 Feb 2006 22:55:23 -0500 (EST) CC: andrew5@ece.cmu.edu, PostgreSQL-patches X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.127 required=5 tests=[AWL=0.127] X-Spam-Score: 0.127 X-Spam-Level: X-Archive-Number: 200602/38 X-Sequence-Number: 18703 Andrew Dunstan wrote: > On Wed, 2006-02-01 at 23:48 -0500, Bruce Momjian wrote: > > I have researched your report, and you are right, there are two ecpg > > bugs here. First, dollar quoting uses single-quotes internally to do > > the quoting, but it does not double any single-quotes in the > > dollar-quoted string. > > > > As a matter of curiosity, why does ecpg handle dollar quoting like that? > psql, for example, happily just passes a dollar quoted string through to > the backend, without any need to convert it to a conventionally quoted > string. ecpg actually parses the statements so it can do things like make variable substitutions. The $$ and '' strings are actually passed to preproc.y as SCONST. parser/scan.l does the same thing, though it doesn't need to single-quote it and pass it up to eventually be output in C. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073