mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +03:00
SQL functions can have arguments and results declared ANYARRAY or
ANYELEMENT. The effect is to postpone typechecking of the function body until runtime. Documentation is still lacking. Original patch by Joe Conway, modified to postpone type checking by Tom Lane.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.142 2003/06/29 00:33:43 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.143 2003/07/01 00:04:37 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -1731,6 +1731,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
|
||||
int *usecounts;
|
||||
List *arg;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
/*
|
||||
* Forget it if the function is not SQL-language or has other
|
||||
@ -1742,12 +1743,20 @@ inline_function(Oid funcid, Oid result_type, List *args,
|
||||
funcform->pronargs != length(args))
|
||||
return NULL;
|
||||
|
||||
/* Forget it if declared return type is tuple or void */
|
||||
/* Forget it if declared return type is not base or domain */
|
||||
result_typtype = get_typtype(funcform->prorettype);
|
||||
if (result_typtype != 'b' &&
|
||||
result_typtype != 'd')
|
||||
return NULL;
|
||||
|
||||
/* Forget it if any declared argument type is polymorphic */
|
||||
for (j = 0; j < funcform->pronargs; j++)
|
||||
{
|
||||
if (funcform->proargtypes[j] == ANYARRAYOID ||
|
||||
funcform->proargtypes[j] == ANYELEMENTOID)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check for recursive function, and give up trying to expand if so */
|
||||
if (oidMember(funcid, active_fns))
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user