From 63e98b55f04004423852fa1e1730761074c412db Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 19 May 2008 04:14:24 +0000 Subject: 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. --- src/backend/utils/adt/ri_triggers.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/backend/utils/adt/ri_triggers.c') diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 59f7e49795..7f564e09fa 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.108 2008/05/12 20:02:02 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.109 2008/05/19 04:14:24 tgl Exp $ * * ---------- */ @@ -3938,8 +3938,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)); -- cgit v1.2.1