@@ -637,21 +637,21 @@ update_proconfig_value(ArrayType *a, List *set_items)
637
637
* attributes.
638
638
*/
639
639
static 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 )
655
655
{
656
656
ListCell * option ;
657
657
DefElem * as_item = NULL ;
@@ -789,59 +789,6 @@ compute_attributes_sql_style(ParseState *pstate,
789
789
}
790
790
791
791
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
-
845
792
/*
846
793
* For a dynamically linked C language object, the form of the clause is
847
794
*
@@ -909,7 +856,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName,
909
856
910
857
/*
911
858
* CreateFunction
912
- * Execute a CREATE FUNCTION utility statement.
859
+ * Execute a CREATE FUNCTION (or CREATE PROCEDURE) utility statement.
913
860
*/
914
861
ObjectAddress
915
862
CreateFunction (ParseState * pstate , CreateFunctionStmt * stmt )
@@ -957,7 +904,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
957
904
aclcheck_error (aclresult , OBJECT_SCHEMA ,
958
905
get_namespace_name (namespaceId ));
959
906
960
- /* default attributes */
907
+ /* Set default attributes */
961
908
isWindowFunc = false;
962
909
isStrict = false;
963
910
security = false;
@@ -968,14 +915,14 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
968
915
prorows = -1 ; /* indicates not set */
969
916
parallel = PROPARALLEL_UNSAFE ;
970
917
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 );
979
926
980
927
/* Look up the language and validate permissions */
981
928
languageTuple = SearchSysCache1 (LANGNAME , PointerGetDatum (language ));
@@ -1107,8 +1054,6 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
1107
1054
trftypes = NULL ;
1108
1055
}
1109
1056
1110
- compute_attributes_with_style (pstate , stmt -> is_procedure , stmt -> withClause , & isStrict , & volatility );
1111
-
1112
1057
interpret_AS_clause (languageOid , language , funcname , as_clause ,
1113
1058
& prosrc_str , & probin_str );
1114
1059
@@ -2269,7 +2214,7 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic)
2269
2214
FuncExpr * fexpr ;
2270
2215
int nargs ;
2271
2216
int i ;
2272
- AclResult aclresult ;
2217
+ AclResult aclresult ;
2273
2218
FmgrInfo flinfo ;
2274
2219
FunctionCallInfoData fcinfo ;
2275
2220
CallContext * callcontext ;
@@ -2329,7 +2274,7 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic)
2329
2274
InitFunctionCallInfoData (fcinfo , & flinfo , nargs , fexpr -> inputcollid , (Node * ) callcontext , NULL );
2330
2275
2331
2276
i = 0 ;
2332
- foreach (lc , fexpr -> args )
2277
+ foreach (lc , fexpr -> args )
2333
2278
{
2334
2279
EState * estate ;
2335
2280
ExprState * exprstate ;
0 commit comments