Re: [BUGS] BUG #2171: Differences compiling plpgsql in ecpg - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [BUGS] BUG #2171: Differences compiling plpgsql in ecpg
Date
Msg-id 200602030355.k133tNw00862@candle.pha.pa.us
Whole thread Raw
In response to Re: [BUGS] BUG #2171: Differences compiling plpgsql in  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Stephen Frost
Date:
Subject: Re: pg_restore COPY error handling
Next
From: Bruce Momjian
Date:
Subject: Re: [BUGS] BUG #2171: Differences compiling plpgsql in ecpg and psql