Re: Wierd "ProgrammingError" with "E" string prefix

Karsten Hilbert <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Wed, Mar 04, 2009 at 11:04:27AM -0800, Tim Roberts wrote:

> > Well, the entirety of >>>SELECT E'bar' AS foo<<< is the
> > Python string (== the query) that is going to be sent to
> > PostgreSQL (if doing curs.execute(), that is).
> >
> > Nonetheless, the E'bar' *inside* it is going to be
> > interpreted by PostgreSQL as a "string", in particular one
> > with C-like escapes:
> >
> > 	http://www.postgresql.org/docs/8.3/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
> >
> > That's why psycopg2 generates E''s.
> 
> Ah, now I understand.  Psycopg2 generates the E prefix intentionally,
> because that's what is appropriate for field VALUES.  This is simply the
> way the original problem manifests itself.
Yep.

> See?  I can be taught.
There never was any doubt !   :-)

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.