OSDN Git Service

Support "variadic" functions, which can accept a variable number of arguments
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 16 Jul 2008 01:30:23 +0000 (01:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 16 Jul 2008 01:30:23 +0000 (01:30 +0000)
commitd89737d31c03d90a2b0412e63953493576a2a3d7
tree0afc63e59fae7ec3c53339641a6f65e6a04733d2
parent2c773296f88fe800315ca1bf131287662ecef999
Support "variadic" functions, which can accept a variable number of arguments
so long as all the trailing arguments are of the same (non-array) type.
The function receives them as a single array argument (which is why they
have to all be the same type).

It might be useful to extend this facility to aggregates, but this patch
doesn't do that.

This patch imposes a noticeable slowdown on function lookup --- a follow-on
patch will fix that by adding a redundant column to pg_proc.

Pavel Stehule
38 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/extend.sgml
doc/src/sgml/plpgsql.sgml
doc/src/sgml/ref/alter_function.sgml
doc/src/sgml/ref/comment.sgml
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/ref/drop_function.sgml
doc/src/sgml/typeconv.sgml
doc/src/sgml/xfunc.sgml
src/backend/catalog/information_schema.sql
src/backend/catalog/namespace.c
src/backend/catalog/pg_aggregate.c
src/backend/commands/functioncmds.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/parser/gram.y
src/backend/parser/keywords.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_utilcmd.c
src/backend/utils/adt/regproc.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/fmgr/funcapi.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/describe.c
src/include/catalog/catversion.h
src/include/catalog/namespace.h
src/include/catalog/pg_proc.h
src/include/nodes/parsenodes.h
src/include/parser/parse_func.h
src/interfaces/ecpg/preproc/preproc.y
src/pl/plpgsql/src/pl_comp.c
src/pl/plpython/plpython.c
src/test/regress/expected/plpgsql.out
src/test/regress/expected/polymorphism.out
src/test/regress/sql/plpgsql.sql
src/test/regress/sql/polymorphism.sql