]> granicus.if.org Git - postgresql/commit
Fix mapping of PostgreSQL encodings to Python encodings.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 5 Jul 2012 19:16:29 +0000 (22:16 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 5 Jul 2012 19:32:12 +0000 (22:32 +0300)
commit2956745fa7488ec810b5752dadca5511011ed0b6
treeb61cbde7cf1594a6414bc2385e453b420e17cca5
parent5b214b4d90608425cc9e6ed870583b3c61c0a39e
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.
src/pl/plpython/plpython.c