On fre, 2010-06-25 at 10:17 -0400, Tom Lane wrote: > Peter Eisentraut <pete...@gmx.net> writes: > > The problem is apparently that when CREATE LANGUAGE creates a language > > from a pg_pltemplate entry, it creates the proname from the tmplhandler > > name, and if it finds a fitting proname entry already, it used that one. > > So when you create plpython2 first and plpython3 second, the pg_language > > entries of the latter point to the pg_proc entries of the former. > > > If you fix that up manually (create additional pg_proc entries and fix > > the pg_language entries to point there), it works better. > > The fix ought to be to change the function nmes used by plpython3 ...
Right. What shall we do about the catversion?
Index: src/include/catalog/pg_pltemplate.h =================================================================== RCS file: /cvsroot/pgsql/src/include/catalog/pg_pltemplate.h,v retrieving revision 1.13 diff -u -3 -p -r1.13 pg_pltemplate.h --- src/include/catalog/pg_pltemplate.h 22 Jan 2010 15:45:15 -0000 1.13 +++ src/include/catalog/pg_pltemplate.h 25 Jun 2010 18:46:56 -0000 @@ -74,6 +74,6 @@ DATA(insert ( "plperl" t t "plperl_call DATA(insert ( "plperlu" f f "plperl_call_handler" "plperl_inline_handler" "plperl_validator" "$libdir/plperl" _null_ )); DATA(insert ( "plpythonu" f f "plpython_call_handler" "plpython_inline_handler" _null_ "$libdir/plpython" _null_ )); DATA(insert ( "plpython2u" f f "plpython_call_handler" "plpython_inline_handler" _null_ "$libdir/plpython2" _null_ )); -DATA(insert ( "plpython3u" f f "plpython_call_handler" "plpython_inline_handler" _null_ "$libdir/plpython3" _null_ )); +DATA(insert ( "plpython3u" f f "plpython3_call_handler" "plpython3_inline_handler" _null_ "$libdir/plpython3" _null_ )); #endif /* PG_PLTEMPLATE_H */ Index: src/pl/plpython/plpython.c =================================================================== RCS file: /cvsroot/pgsql/src/pl/plpython/plpython.c,v retrieving revision 1.144 diff -u -3 -p -r1.144 plpython.c --- src/pl/plpython/plpython.c 10 Jun 2010 04:05:01 -0000 1.144 +++ src/pl/plpython/plpython.c 25 Jun 2010 18:46:56 -0000 @@ -244,6 +244,12 @@ typedef struct PLyResultObject /* function declarations */ +#if PY_MAJOR_VERSION >= 3 +/* Use separate names to avoid clash in pg_pltemplate */ +#define plpython_call_handler plpython3_call_handler +#define plpython_inline_handler plpython3_inline_handler +#endif + /* exported functions */ Datum plpython_call_handler(PG_FUNCTION_ARGS); Datum plpython_inline_handler(PG_FUNCTION_ARGS);
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers