Skip to content

Commit 53367e6

Browse files
committed
Clarify comments in enforce_generic_type_consistency().
Some of the pre-existing comments were vague about whether they referred to all polymorphic types or only the old-style ones. Also be more consistent about using the "family 1" vs "family 2" terminology. Himanshu Upadhyaya and Tom Lane Discussion: https://postgr.es/m/CAPF61jBUg9XoMPNuLpoZ+h6UZ2VxKdNt3rQL1xw1GOBwjWzAXQ@mail.gmail.com
1 parent 9c79e64 commit 53367e6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/backend/parser/parse_coerce.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -2155,8 +2155,8 @@ enforce_generic_type_consistency(const Oid *actual_arg_types,
21552155
else
21562156
{
21572157
/*
2158-
* Only way to get here is if all the polymorphic args have
2159-
* UNKNOWN inputs
2158+
* Only way to get here is if all the family-1 polymorphic
2159+
* arguments have UNKNOWN inputs.
21602160
*/
21612161
ereport(ERROR,
21622162
(errcode(ERRCODE_DATATYPE_MISMATCH),
@@ -2254,10 +2254,10 @@ enforce_generic_type_consistency(const Oid *actual_arg_types,
22542254
else
22552255
{
22562256
/*
2257-
* Only way to get here is if all the ANYCOMPATIBLE args have
2258-
* UNKNOWN inputs. Resolve to TEXT as select_common_type()
2259-
* would do. That doesn't license us to use TEXTRANGE,
2260-
* though.
2257+
* Only way to get here is if all the family-2 polymorphic
2258+
* arguments have UNKNOWN inputs. Resolve to TEXT as
2259+
* select_common_type() would do. That doesn't license us to
2260+
* use TEXTRANGE, though.
22612261
*/
22622262
anycompatible_typeid = TEXTOID;
22632263
anycompatible_array_typeid = TEXTARRAYOID;
@@ -2269,7 +2269,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types,
22692269
}
22702270
}
22712271

2272-
/* replace polymorphic types by selected types */
2272+
/* replace family-2 polymorphic types by selected types */
22732273
for (int j = 0; j < nargs; j++)
22742274
{
22752275
Oid decl_type = declared_arg_types[j];
@@ -2285,11 +2285,11 @@ enforce_generic_type_consistency(const Oid *actual_arg_types,
22852285
}
22862286

22872287
/*
2288-
* If we had any UNKNOWN inputs for polymorphic arguments, re-scan to
2289-
* assign correct types to them.
2288+
* If we had any UNKNOWN inputs for family-1 polymorphic arguments,
2289+
* re-scan to assign correct types to them.
22902290
*
22912291
* Note: we don't have to consider unknown inputs that were matched to
2292-
* ANYCOMPATIBLE-family arguments, because we forcibly updated their
2292+
* family-2 polymorphic arguments, because we forcibly updated their
22932293
* declared_arg_types[] positions just above.
22942294
*/
22952295
if (have_poly_unknowns)

0 commit comments

Comments
 (0)