diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-19 04:14:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-19 04:14:33 +0000 |
commit | 7e1cb8246936b3ad2faa7285e373cbb09b49dc88 (patch) | |
tree | acf1379315fe16f9542d795131aacccc8a0e2f6b /src/backend/utils/adt/ri_triggers.c | |
parent | 2d7a219b0d7a3b3519be65ead0f5dd7606d7f206 (diff) |
Coercion sanity check in ri_HashCompareOp failed to allow for enums, as per
example from Rod Taylor. On reflection the correct test here is for any
polymorphic type, not specifically ANYARRAY as in the original coding.
Diffstat (limited to 'src/backend/utils/adt/ri_triggers.c')
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index ce560054cea..acb1118f649 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -15,7 +15,7 @@ * * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.103.2.1 2008/02/18 23:00:38 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.103.2.2 2008/05/19 04:14:33 tgl Exp $ * * ---------- */ @@ -3933,8 +3933,12 @@ ri_HashCompareOp(Oid eq_opr, Oid typeid) if (pathtype != COERCION_PATH_FUNC && pathtype != COERCION_PATH_RELABELTYPE) { - /* If target is ANYARRAY, assume it's OK, else punt. */ - if (lefttype != ANYARRAYOID) + /* + * The declared input type of the eq_opr might be a + * polymorphic type such as ANYARRAY or ANYENUM. If so, + * assume the coercion is valid; otherwise complain. + */ + if (!IsPolymorphicType(lefttype)) elog(ERROR, "no conversion function from %s to %s", format_type_be(typeid), format_type_be(lefttype)); |