@@ -637,21 +637,21 @@ update_proconfig_value(ArrayType *a, List *set_items)
637637 * attributes.
638638 */
639639static void
640- compute_attributes_sql_style (ParseState * pstate ,
641- bool is_procedure ,
642- List * options ,
643- List * * as ,
644- char * * language ,
645- Node * * transform ,
646- bool * windowfunc_p ,
647- char * volatility_p ,
648- bool * strict_p ,
649- bool * security_definer ,
650- bool * leakproof_p ,
651- ArrayType * * proconfig ,
652- float4 * procost ,
653- float4 * prorows ,
654- char * parallel_p )
640+ compute_function_attributes (ParseState * pstate ,
641+ bool is_procedure ,
642+ List * options ,
643+ List * * as ,
644+ char * * language ,
645+ Node * * transform ,
646+ bool * windowfunc_p ,
647+ char * volatility_p ,
648+ bool * strict_p ,
649+ bool * security_definer ,
650+ bool * leakproof_p ,
651+ ArrayType * * proconfig ,
652+ float4 * procost ,
653+ float4 * prorows ,
654+ char * parallel_p )
655655{
656656 ListCell * option ;
657657 DefElem * as_item = NULL ;
@@ -789,59 +789,6 @@ compute_attributes_sql_style(ParseState *pstate,
789789}
790790
791791
792- /*-------------
793- * Interpret the parameters *parameters and return their contents via
794- * *isStrict_p and *volatility_p.
795- *
796- * These parameters supply optional information about a function.
797- * All have defaults if not specified. Parameters:
798- *
799- * * isStrict means the function should not be called when any NULL
800- * inputs are present; instead a NULL result value should be assumed.
801- *
802- * * volatility tells the optimizer whether the function's result can
803- * be assumed to be repeatable over multiple evaluations.
804- *------------
805- */
806- static void
807- compute_attributes_with_style (ParseState * pstate , bool is_procedure , List * parameters , bool * isStrict_p , char * volatility_p )
808- {
809- ListCell * pl ;
810-
811- foreach (pl , parameters )
812- {
813- DefElem * param = (DefElem * ) lfirst (pl );
814-
815- if (pg_strcasecmp (param -> defname , "isstrict" ) == 0 )
816- {
817- if (is_procedure )
818- ereport (ERROR ,
819- (errcode (ERRCODE_INVALID_FUNCTION_DEFINITION ),
820- errmsg ("invalid attribute in procedure definition" ),
821- parser_errposition (pstate , param -> location )));
822- * isStrict_p = defGetBoolean (param );
823- }
824- else if (pg_strcasecmp (param -> defname , "iscachable" ) == 0 )
825- {
826- /* obsolete spelling of isImmutable */
827- if (is_procedure )
828- ereport (ERROR ,
829- (errcode (ERRCODE_INVALID_FUNCTION_DEFINITION ),
830- errmsg ("invalid attribute in procedure definition" ),
831- parser_errposition (pstate , param -> location )));
832- if (defGetBoolean (param ))
833- * volatility_p = PROVOLATILE_IMMUTABLE ;
834- }
835- else
836- ereport (WARNING ,
837- (errcode (ERRCODE_SYNTAX_ERROR ),
838- errmsg ("unrecognized function attribute \"%s\" ignored" ,
839- param -> defname ),
840- parser_errposition (pstate , param -> location )));
841- }
842- }
843-
844-
845792/*
846793 * For a dynamically linked C language object, the form of the clause is
847794 *
@@ -909,7 +856,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName,
909856
910857/*
911858 * CreateFunction
912- * Execute a CREATE FUNCTION utility statement.
859+ * Execute a CREATE FUNCTION (or CREATE PROCEDURE) utility statement.
913860 */
914861ObjectAddress
915862CreateFunction (ParseState * pstate , CreateFunctionStmt * stmt )
@@ -957,7 +904,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
957904 aclcheck_error (aclresult , OBJECT_SCHEMA ,
958905 get_namespace_name (namespaceId ));
959906
960- /* default attributes */
907+ /* Set default attributes */
961908 isWindowFunc = false;
962909 isStrict = false;
963910 security = false;
@@ -968,14 +915,14 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
968915 prorows = -1 ; /* indicates not set */
969916 parallel = PROPARALLEL_UNSAFE ;
970917
971- /* override attributes from explicit list */
972- compute_attributes_sql_style (pstate ,
973- stmt -> is_procedure ,
974- stmt -> options ,
975- & as_clause , & language , & transformDefElem ,
976- & isWindowFunc , & volatility ,
977- & isStrict , & security , & isLeakProof ,
978- & proconfig , & procost , & prorows , & parallel );
918+ /* Extract non-default attributes from stmt->options list */
919+ compute_function_attributes (pstate ,
920+ stmt -> is_procedure ,
921+ stmt -> options ,
922+ & as_clause , & language , & transformDefElem ,
923+ & isWindowFunc , & volatility ,
924+ & isStrict , & security , & isLeakProof ,
925+ & proconfig , & procost , & prorows , & parallel );
979926
980927 /* Look up the language and validate permissions */
981928 languageTuple = SearchSysCache1 (LANGNAME , PointerGetDatum (language ));
@@ -1107,8 +1054,6 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
11071054 trftypes = NULL ;
11081055 }
11091056
1110- compute_attributes_with_style (pstate , stmt -> is_procedure , stmt -> withClause , & isStrict , & volatility );
1111-
11121057 interpret_AS_clause (languageOid , language , funcname , as_clause ,
11131058 & prosrc_str , & probin_str );
11141059
@@ -2269,7 +2214,7 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic)
22692214 FuncExpr * fexpr ;
22702215 int nargs ;
22712216 int i ;
2272- AclResult aclresult ;
2217+ AclResult aclresult ;
22732218 FmgrInfo flinfo ;
22742219 FunctionCallInfoData fcinfo ;
22752220 CallContext * callcontext ;
@@ -2329,7 +2274,7 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic)
23292274 InitFunctionCallInfoData (fcinfo , & flinfo , nargs , fexpr -> inputcollid , (Node * ) callcontext , NULL );
23302275
23312276 i = 0 ;
2332- foreach (lc , fexpr -> args )
2277+ foreach (lc , fexpr -> args )
23332278 {
23342279 EState * estate ;
23352280 ExprState * exprstate ;
0 commit comments