]> granicus.if.org Git - postgresql/commit
Make plpython cope with funny characters in function names.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 Feb 2016 02:08:15 +0000 (21:08 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 Feb 2016 02:08:15 +0000 (21:08 -0500)
commit7d48349fd9cb3c64d53bdecac933f2c44c703f22
treeba2b0d0f23b9fe268118731c400a1573e9e1bd0d
parent528db6ab965d33cfcad7e460b1cc4416f3600c3a
Make plpython cope with funny characters in function names.

A function name that's double-quoted in SQL can contain almost any
characters, but we were using that name directly as part of the name
generated for the Python-level function, and Python doesn't like
anything that isn't pretty much a standard identifier.  To fix,
replace anything that isn't an ASCII letter or digit with an underscore
in the generated name.  This doesn't create any risk of duplicate Python
function names because we were already appending the function OID to
the generated name to ensure uniqueness.  Per bug #13960 from Jim Nasby.

Patch by Jim Nasby, modified a bit by me.  Back-patch to all
supported branches.
src/pl/plpython/expected/plpython_test.out
src/pl/plpython/plpy_procedure.c
src/pl/plpython/sql/plpython_test.sql