mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
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
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.366 2008/05/16 23:36:05 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.367 2008/07/16 01:30:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -261,6 +261,7 @@ typedef struct FuncCall
|
||||
List *args; /* the arguments (list of exprs) */
|
||||
bool agg_star; /* argument was really '*' */
|
||||
bool agg_distinct; /* arguments were labeled DISTINCT */
|
||||
bool func_variadic; /* last argument was labeled VARIADIC */
|
||||
int location; /* token location, or -1 if unknown */
|
||||
} FuncCall;
|
||||
|
||||
@@ -1568,7 +1569,8 @@ typedef enum FunctionParameterMode
|
||||
/* the assigned enum values appear in pg_proc, don't change 'em! */
|
||||
FUNC_PARAM_IN = 'i', /* input only */
|
||||
FUNC_PARAM_OUT = 'o', /* output only */
|
||||
FUNC_PARAM_INOUT = 'b' /* both */
|
||||
FUNC_PARAM_INOUT = 'b', /* both */
|
||||
FUNC_PARAM_VARIADIC = 'v' /* variadic */
|
||||
} FunctionParameterMode;
|
||||
|
||||
typedef struct FunctionParameter
|
||||
|
||||
Reference in New Issue
Block a user