Re: PQescapeLiteral in Libpq - Mailing list pgsql-novice

From Tom Lane
Subject Re: PQescapeLiteral in Libpq
Date
Msg-id 16244.1389295957@sss.pgh.pa.us
Whole thread Raw
In response to PQescapeLiteral in Libpq  ("lmanorders" <lmanorders@gmail.com>)
List pgsql-novice
"lmanorders" <lmanorders@gmail.com> writes:
> I'm using the libpq.dll libraries to connect to postgress. When I issue a call to PQescapeLiteral with a file path as
theargument, the result string seems to always start with a bogus " E". 

That's not bogus, it's the intended behavior.  Per the source code:

     * If we are escaping a literal that contains backslashes, we use the
     * escape string syntax so that the result is correct under either value
     * of standard_conforming_strings.  We also emit a leading space in this
     * case, to guard against the possibility that the result might be
     * interpolated immediately following an identifier.

            regards, tom lane


pgsql-novice by date:

Previous
From: "lmanorders"
Date:
Subject: PQescapeLiteral in Libpq
Next
From: David Johnston
Date:
Subject: Re: PQescapeLiteral in Libpq