@@ -3834,16 +3834,15 @@ concat_internal(const char *sepstr, int argidx,
38343834 return NULL ;
38353835
38363836 /*
3837- * Non-null argument had better be an array
3838- *
3839- * Correct values are ensured by parser check, but this function
3840- * can be called directly, bypassing the parser, so we should do
3841- * some minimal check too - this form of call requires correctly set
3842- * expr argtype in flinfo.
3837+ * Non-null argument had better be an array. We assume that any call
3838+ * context that could let get_fn_expr_variadic return true will have
3839+ * checked that a VARIADIC-labeled parameter actually is an array. So
3840+ * it should be okay to just Assert that it's an array rather than
3841+ * doing a full-fledged error check.
38433842 */
3844- Assert (OidIsValid (get_fn_expr_argtype (fcinfo -> flinfo , argidx )));
3845- Assert (OidIsValid (get_element_type (get_fn_expr_argtype (fcinfo -> flinfo , argidx ))));
3843+ Assert (OidIsValid (get_base_element_type (get_fn_expr_argtype (fcinfo -> flinfo , argidx ))));
38463844
3845+ /* OK, safe to fetch the array value */
38473846 arr = PG_GETARG_ARRAYTYPE_P (argidx );
38483847
38493848 /*
@@ -4063,16 +4062,15 @@ text_format(PG_FUNCTION_ARGS)
40634062 else
40644063 {
40654064 /*
4066- * Non-null argument had better be an array
4067- *
4068- * Correct values are ensured by parser check, but this function
4069- * can be called directly, bypassing the parser, so we should do
4070- * some minimal check too - this form of call requires correctly set
4071- * expr argtype in flinfo.
4065+ * Non-null argument had better be an array. We assume that any
4066+ * call context that could let get_fn_expr_variadic return true
4067+ * will have checked that a VARIADIC-labeled parameter actually is
4068+ * an array. So it should be okay to just Assert that it's an
4069+ * array rather than doing a full-fledged error check.
40724070 */
4073- Assert (OidIsValid (get_fn_expr_argtype (fcinfo -> flinfo , 1 )));
4074- Assert (OidIsValid (get_element_type (get_fn_expr_argtype (fcinfo -> flinfo , 1 ))));
4071+ Assert (OidIsValid (get_base_element_type (get_fn_expr_argtype (fcinfo -> flinfo , 1 ))));
40754072
4073+ /* OK, safe to fetch the array value */
40764074 arr = PG_GETARG_ARRAYTYPE_P (1 );
40774075
40784076 /* Get info about array element type */
0 commit comments