Re: Re: [COMMITTERS] pgsql: Fix mapping of PostgreSQL encodings to Python encodings.
Jan Urbański <wulczer@wulczer.org>
From: Jan Urbański <wulczer@wulczer.org>
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: Peter Eisentraut <peter_e@gmx.net>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgreSQL.org>, Asif Naeem <asif.naeem@enterprisedb.com>
Date: 2012-07-06T15:01:52Z
Lists: pgsql-hackers
Attachments
- plpython-encodings-fix.patch (text/x-diff) patch
On 06/07/12 10:14, Jan Urbański wrote: > On 06/07/12 10:05, Heikki Linnakangas wrote: >> In the backend elog routines, there is a global variable >> 'recursion_depth', which is incremented when an error-handling routine >> is entered, and decremented afterwards. Can we use a similar mechinism >> in PLy_elog() to detect and stop recursion? > > I guess we can, I'll try to do some tests in order to see if there's an > easy user-triggereable way of causing PLy_elog to recurse and if not > then a guard like this should be enough as a safety measure against as > yet unknown conditions (as opposed to something we expect to happen > regularly). Attached is a patch that stores the recursion level of PLy_traceback and prevents it from running if it's too deep (PLy_traceback is the one doing heavy lifting, that's why I chose to put the logic to skip running there). I tried a few things and was not able to easily invoke the infinite recursion condition, but I did notice that there are two more encodings that have different names in Postgres and in Python (KOI8-R and KOI8-U) and added them to the switch. There's still trouble with EUC_TW and MULE_INTERNAL which don't have Python equivalents. EUC-TW has been discussed in http://bugs.python.org/issue2066 and rejected (see http://bugs.python.org/issue2066#msg113731). If you use any of these encodings, you *will* get into the recursion trouble described eariler, just as before the path you'd get into it with CP1252 as your encoding. What shall we do about those? Ignore them? Document that if you're sing one of these encodings then PL/Python with Python 2 will be crippled and with Python 3 just won't work? Cheers, Jan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix mapping of PostgreSQL encodings to Python encodings.
- b66de4c6d720 9.3.0 cited