pgsql: Fix mapping of PostgreSQL encodings to Python encodings. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Fix mapping of PostgreSQL encodings to Python encodings.
Date
Msg-id E1Smro2-0006gX-MH@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix mapping of PostgreSQL encodings to Python encodings.

Windows encodings, "win1252" and so forth, are named differently in Python,
like "cp1252". Also, if the PyUnicode_AsEncodedString() function call fails
for some reason, use a plain ereport(), not a PLy_elog(), to report that
error. That avoids recursion and crash, if PLy_elog() tries to call
PLyUnicode_Bytes() again.

This fixes bug reported by Asif Naeem. Backpatch down to 9.0, before that
plpython didn't even try these conversions.

Jan Urbański, with minor comment improvements by me.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/138313ebaa985030d75d429c3b3cb7138e62b10f

Modified Files
--------------
src/pl/plpython/plpython.c |   69 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 62 insertions(+), 7 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Remove support for using wait3() in place of waitpid().
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix mapping of PostgreSQL encodings to Python encodings.