Unexpected argument handling in pl/python variadic argument function create or replace function variadic_sql (template text, variadic args text[], out text) language sql as $$ select $1 || ' -- ' || $2::text $$;
create or replace function variadic_python (template text, variadic args text[], out text) language plpythonu as $$ return template + ' -- ' + str(args) $$; -- expected select variadic_sql('<html>{foo}{bar}</html>', '1', '2'); variadic_sql ------------------------------------ <html>{foo}{bar}</html> -- {1,2} -- first scalar arg also in the variadic args select variadic_python('<html>{foo}{bar}</html>', '1', '2'); variadic_python ---------------------------------------------------------------------- <html>{foo}{bar}</html> -- ['<html>{foo}{bar}</html>', ['1', '2']] select version(); PostgreSQL 9.0.1 on i686-pc-linux-gnu, compiled by GCC i686-pc-linux-gnu-gcc (Gentoo 4.4.2 p1.0) 4.4.2, 32-bit (1 row) I could not find very much documentation and only this on the lists: from Jan Urbański on his planned improvements for pl/python: http://archives.postgresql.org/pgsql-hackers/2010-12/msg00551.php > * variadic argument handling (is this possible for a non-plpgsql pl?) Does this mean this is already a recognized flaw or it was unknown at the time if the feature was implemented? I would definitely would not expect the argument to duplicated. I know there is big patch for pl/python being reviewed right now. Perhaps this is being fixed? It would be wonderful for plpython to support complex arguments gracefully. -- Thanks, Nate Carson -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers