Re: Wierd "ProgrammingError" with "E" string prefix
Tim Roberts <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | Providenza & Boekelheide, Inc. |
| Message-ID | <[email protected]> |
Karsten Hilbert 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. See? I can be taught. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc.