@@ -366,7 +366,9 @@ ExecReadyInterpretedExpr(ExprState *state)
366
366
return ;
367
367
}
368
368
else if (step0 == EEOP_CASE_TESTVAL &&
369
- step1 == EEOP_FUNCEXPR_STRICT )
369
+ (step1 == EEOP_FUNCEXPR_STRICT ||
370
+ step1 == EEOP_FUNCEXPR_STRICT_1 ||
371
+ step1 == EEOP_FUNCEXPR_STRICT_2 ))
370
372
{
371
373
state -> evalfunc_private = ExecJustApplyFuncToCase ;
372
374
return ;
@@ -498,6 +500,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
498
500
& & CASE_EEOP_CONST ,
499
501
& & CASE_EEOP_FUNCEXPR ,
500
502
& & CASE_EEOP_FUNCEXPR_STRICT ,
503
+ & & CASE_EEOP_FUNCEXPR_STRICT_1 ,
504
+ & & CASE_EEOP_FUNCEXPR_STRICT_2 ,
501
505
& & CASE_EEOP_FUNCEXPR_FUSAGE ,
502
506
& & CASE_EEOP_FUNCEXPR_STRICT_FUSAGE ,
503
507
& & CASE_EEOP_BOOL_AND_STEP_FIRST ,
@@ -575,6 +579,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
575
579
& & CASE_EEOP_AGG_STRICT_DESERIALIZE ,
576
580
& & CASE_EEOP_AGG_DESERIALIZE ,
577
581
& & CASE_EEOP_AGG_STRICT_INPUT_CHECK_ARGS ,
582
+ & & CASE_EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1 ,
578
583
& & CASE_EEOP_AGG_STRICT_INPUT_CHECK_NULLS ,
579
584
& & CASE_EEOP_AGG_PLAIN_PERGROUP_NULLCHECK ,
580
585
& & CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL ,
@@ -925,13 +930,16 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
925
930
EEO_NEXT ();
926
931
}
927
932
933
+ /* strict function call with more than two arguments */
928
934
EEO_CASE (EEOP_FUNCEXPR_STRICT )
929
935
{
930
936
FunctionCallInfo fcinfo = op -> d .func .fcinfo_data ;
931
937
NullableDatum * args = fcinfo -> args ;
932
938
int nargs = op -> d .func .nargs ;
933
939
Datum d ;
934
940
941
+ Assert (nargs > 2 );
942
+
935
943
/* strict function, so check for NULL args */
936
944
for (int argno = 0 ; argno < nargs ; argno ++ )
937
945
{
@@ -950,6 +958,54 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
950
958
EEO_NEXT ();
951
959
}
952
960
961
+ /* strict function call with one argument */
962
+ EEO_CASE (EEOP_FUNCEXPR_STRICT_1 )
963
+ {
964
+ FunctionCallInfo fcinfo = op -> d .func .fcinfo_data ;
965
+ NullableDatum * args = fcinfo -> args ;
966
+
967
+ Assert (op -> d .func .nargs == 1 );
968
+
969
+ /* strict function, so check for NULL args */
970
+ if (args [0 ].isnull )
971
+ * op -> resnull = true;
972
+ else
973
+ {
974
+ Datum d ;
975
+
976
+ fcinfo -> isnull = false;
977
+ d = op -> d .func .fn_addr (fcinfo );
978
+ * op -> resvalue = d ;
979
+ * op -> resnull = fcinfo -> isnull ;
980
+ }
981
+
982
+ EEO_NEXT ();
983
+ }
984
+
985
+ /* strict function call with two arguments */
986
+ EEO_CASE (EEOP_FUNCEXPR_STRICT_2 )
987
+ {
988
+ FunctionCallInfo fcinfo = op -> d .func .fcinfo_data ;
989
+ NullableDatum * args = fcinfo -> args ;
990
+
991
+ Assert (op -> d .func .nargs == 2 );
992
+
993
+ /* strict function, so check for NULL args */
994
+ if (args [0 ].isnull || args [1 ].isnull )
995
+ * op -> resnull = true;
996
+ else
997
+ {
998
+ Datum d ;
999
+
1000
+ fcinfo -> isnull = false;
1001
+ d = op -> d .func .fn_addr (fcinfo );
1002
+ * op -> resvalue = d ;
1003
+ * op -> resnull = fcinfo -> isnull ;
1004
+ }
1005
+
1006
+ EEO_NEXT ();
1007
+ }
1008
+
953
1009
EEO_CASE (EEOP_FUNCEXPR_FUSAGE )
954
1010
{
955
1011
/* not common enough to inline */
@@ -1982,11 +2038,14 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
1982
2038
* input is not NULL.
1983
2039
*/
1984
2040
2041
+ /* when checking more than one argument */
1985
2042
EEO_CASE (EEOP_AGG_STRICT_INPUT_CHECK_ARGS )
1986
2043
{
1987
2044
NullableDatum * args = op -> d .agg_strict_input_check .args ;
1988
2045
int nargs = op -> d .agg_strict_input_check .nargs ;
1989
2046
2047
+ Assert (nargs > 1 );
2048
+
1990
2049
for (int argno = 0 ; argno < nargs ; argno ++ )
1991
2050
{
1992
2051
if (args [argno ].isnull )
@@ -1995,6 +2054,19 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
1995
2054
EEO_NEXT ();
1996
2055
}
1997
2056
2057
+ /* special case for just one argument */
2058
+ EEO_CASE (EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1 )
2059
+ {
2060
+ NullableDatum * args = op -> d .agg_strict_input_check .args ;
2061
+ PG_USED_FOR_ASSERTS_ONLY int nargs = op -> d .agg_strict_input_check .nargs ;
2062
+
2063
+ Assert (nargs == 1 );
2064
+
2065
+ if (args [0 ].isnull )
2066
+ EEO_JUMP (op -> d .agg_strict_input_check .jumpnull );
2067
+ EEO_NEXT ();
2068
+ }
2069
+
1998
2070
EEO_CASE (EEOP_AGG_STRICT_INPUT_CHECK_NULLS )
1999
2071
{
2000
2072
bool * nulls = op -> d .agg_strict_input_check .nulls ;
0 commit comments