0002-disallow-unsafe-usage.patch
text/x-diff
Filename: 0002-disallow-unsafe-usage.patch
Type: text/x-diff
Part: 1
Patch
Format: unified
Series: patch 0002
| File | + | − |
|---|---|---|
| src/backend/parser/parse_coerce.c | 4 | 7 |
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 72747be9e2..0b5b81c7f2 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -661,10 +661,8 @@ can_coerce_type(int nargs, const Oid *input_typeids, const Oid *target_typeids,
* Create an expression tree to represent coercion to a domain type.
*
* 'arg': input expression
- * 'baseTypeId': base type of domain, if known (pass InvalidOid if caller
- * has not bothered to look this up)
- * 'baseTypeMod': base type typmod of domain, if known (pass -1 if caller
- * has not bothered to look this up)
+ * 'baseTypeId': base type of domain
+ * 'baseTypeMod': base type typmod of domain
* 'typeId': target type to coerce to
* 'ccontext': context indicator to control coercions
* 'cformat': coercion display format
@@ -680,9 +678,8 @@ coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, Oid typeId,
{
CoerceToDomain *result;
- /* Get the base type if it hasn't been supplied */
- if (baseTypeId == InvalidOid)
- baseTypeId = getBaseTypeAndTypmod(typeId, &baseTypeMod);
+ /* We now require the caller to supply correct baseTypeId/baseTypeMod */
+ Assert(OidIsValid(baseTypeId));
/* If it isn't a domain, return the node as it was passed in */
if (baseTypeId == typeId)