mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Code review for commit d26888bc4d
.
Mostly, copy-edit the comments; but also fix it to not reject domains over arrays.
This commit is contained in:
@ -3834,16 +3834,15 @@ concat_internal(const char *sepstr, int argidx,
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Non-null argument had better be an array
|
||||
*
|
||||
* Correct values are ensured by parser check, but this function
|
||||
* can be called directly, bypassing the parser, so we should do
|
||||
* some minimal check too - this form of call requires correctly set
|
||||
* expr argtype in flinfo.
|
||||
* Non-null argument had better be an array. We assume that any call
|
||||
* context that could let get_fn_expr_variadic return true will have
|
||||
* checked that a VARIADIC-labeled parameter actually is an array. So
|
||||
* it should be okay to just Assert that it's an array rather than
|
||||
* doing a full-fledged error check.
|
||||
*/
|
||||
Assert(OidIsValid(get_fn_expr_argtype(fcinfo->flinfo, argidx)));
|
||||
Assert(OidIsValid(get_element_type(get_fn_expr_argtype(fcinfo->flinfo, argidx))));
|
||||
Assert(OidIsValid(get_base_element_type(get_fn_expr_argtype(fcinfo->flinfo, argidx))));
|
||||
|
||||
/* OK, safe to fetch the array value */
|
||||
arr = PG_GETARG_ARRAYTYPE_P(argidx);
|
||||
|
||||
/*
|
||||
@ -4063,16 +4062,15 @@ text_format(PG_FUNCTION_ARGS)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Non-null argument had better be an array
|
||||
*
|
||||
* Correct values are ensured by parser check, but this function
|
||||
* can be called directly, bypassing the parser, so we should do
|
||||
* some minimal check too - this form of call requires correctly set
|
||||
* expr argtype in flinfo.
|
||||
* Non-null argument had better be an array. We assume that any
|
||||
* call context that could let get_fn_expr_variadic return true
|
||||
* will have checked that a VARIADIC-labeled parameter actually is
|
||||
* an array. So it should be okay to just Assert that it's an
|
||||
* array rather than doing a full-fledged error check.
|
||||
*/
|
||||
Assert(OidIsValid(get_fn_expr_argtype(fcinfo->flinfo, 1)));
|
||||
Assert(OidIsValid(get_element_type(get_fn_expr_argtype(fcinfo->flinfo, 1))));
|
||||
Assert(OidIsValid(get_base_element_type(get_fn_expr_argtype(fcinfo->flinfo, 1))));
|
||||
|
||||
/* OK, safe to fetch the array value */
|
||||
arr = PG_GETARG_ARRAYTYPE_P(1);
|
||||
|
||||
/* Get info about array element type */
|
||||
|
Reference in New Issue
Block a user