pgsql: Support "variadic" functions, which can accept a variable number

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support "variadic" functions, which can accept a variable number
Date: 2008-07-16 01:30:24
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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

Modified Files:
--------------
pgsql/doc/src/sgml:
catalogs.sgml (r2.168 -> r2.169)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/catalogs.sgml?r1=2.168&r2=2.169)
extend.sgml (r1.36 -> r1.37)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/extend.sgml?r1=1.36&r2=1.37)
plpgsql.sgml (r1.131 -> r1.132)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/plpgsql.sgml?r1=1.131&r2=1.132)
typeconv.sgml (r1.54 -> r1.55)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/typeconv.sgml?r1=1.54&r2=1.55)
xfunc.sgml (r1.130 -> r1.131)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/xfunc.sgml?r1=1.130&r2=1.131)
pgsql/doc/src/sgml/ref:
alter_function.sgml (r1.15 -> r1.16)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/alter_function.sgml?r1=1.15&r2=1.16)
comment.sgml (r1.36 -> r1.37)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/comment.sgml?r1=1.36&r2=1.37)
create_function.sgml (r1.78 -> r1.79)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/create_function.sgml?r1=1.78&r2=1.79)
drop_function.sgml (r1.33 -> r1.34)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/drop_function.sgml?r1=1.33&r2=1.34)
pgsql/src/backend/catalog:
information_schema.sql (r1.43 -> r1.44)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/information_schema.sql?r1=1.43&r2=1.44)
namespace.c (r1.107 -> r1.108)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/namespace.c?r1=1.107&r2=1.108)
pg_aggregate.c (r1.93 -> r1.94)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/pg_aggregate.c?r1=1.93&r2=1.94)
pgsql/src/backend/commands:
functioncmds.c (r1.95 -> r1.96)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/functioncmds.c?r1=1.95&r2=1.96)
pgsql/src/backend/nodes:
copyfuncs.c (r1.394 -> r1.395)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.394&r2=1.395)
equalfuncs.c (r1.323 -> r1.324)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.323&r2=1.324)
outfuncs.c (r1.326 -> r1.327)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.326&r2=1.327)
pgsql/src/backend/parser:
gram.y (r2.616 -> r2.617)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y?r1=2.616&r2=2.617)
keywords.c (r1.198 -> r1.199)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/keywords.c?r1=1.198&r2=1.199)
parse_expr.c (r1.228 -> r1.229)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_expr.c?r1=1.228&r2=1.229)
parse_func.c (r1.202 -> r1.203)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_func.c?r1=1.202&r2=1.203)
parse_utilcmd.c (r2.13 -> r2.14)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_utilcmd.c?r1=2.13&r2=2.14)
pgsql/src/backend/utils/adt:
regproc.c (r1.107 -> r1.108)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/regproc.c?r1=1.107&r2=1.108)
ruleutils.c (r1.275 -> r1.276)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/ruleutils.c?r1=1.275&r2=1.276)
pgsql/src/backend/utils/fmgr:
funcapi.c (r1.39 -> r1.40)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/fmgr/funcapi.c?r1=1.39&r2=1.40)
pgsql/src/bin/pg_dump:
pg_dump.c (r1.493 -> r1.494)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_dump.c?r1=1.493&r2=1.494)
pgsql/src/bin/psql:
describe.c (r1.181 -> r1.182)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.c?r1=1.181&r2=1.182)
pgsql/src/include/catalog:
catversion.h (r1.468 -> r1.469)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.468&r2=1.469)
namespace.h (r1.54 -> r1.55)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/namespace.h?r1=1.54&r2=1.55)
pg_proc.h (r1.506 -> r1.507)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h?r1=1.506&r2=1.507)
pgsql/src/include/nodes:
parsenodes.h (r1.366 -> r1.367)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.366&r2=1.367)
pgsql/src/include/parser:
parse_func.h (r1.59 -> r1.60)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/parse_func.h?r1=1.59&r2=1.60)
pgsql/src/interfaces/ecpg/preproc:
preproc.y (r1.368 -> r1.369)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/preproc/preproc.y?r1=1.368&r2=1.369)
pgsql/src/pl/plpgsql/src:
pl_comp.c (r1.126 -> r1.127)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_comp.c?r1=1.126&r2=1.127)
pgsql/src/pl/plpython:
plpython.c (r1.110 -> r1.111)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpython/plpython.c?r1=1.110&r2=1.111)
pgsql/src/test/regress/expected:
plpgsql.out (r1.64 -> r1.65)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/plpgsql.out?r1=1.64&r2=1.65)
polymorphism.out (r1.12 -> r1.13)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/polymorphism.out?r1=1.12&r2=1.13)
pgsql/src/test/regress/sql:
plpgsql.sql (r1.54 -> r1.55)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/plpgsql.sql?r1=1.54&r2=1.55)
polymorphism.sql (r1.5 -> r1.6)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/polymorphism.sql?r1=1.5&r2=1.6)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message User Mkz 2008-07-16 14:26:47 pgbouncer - pgbouncer: Further memory conservation by making state
Previous Message Bruce Momjian 2008-07-16 00:48:54 pgsql: Add array_fill() to create arrays initialized with a value.