"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The fact that a domain over an array isn’t being seen as an array here
> seems like a bug.
Hmm. The attached quick-hack patch seems to make this better, but
I'm not sure whether there are any cases it makes worse.
regards, tom lane
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index cf64afbd85..f36b23092d 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -867,9 +867,11 @@ make_scalar_array_op(ParseState *pstate, List *opname,
* Now switch back to the array type on the right, arranging for any
* needed cast to be applied. Beware of polymorphic operators here;
* enforce_generic_type_consistency may or may not have replaced a
- * polymorphic type with a real one.
+ * polymorphic type with a real one. RECORD acts like a polymorphic type
+ * for this purpose, too.
*/
- if (IsPolymorphicType(declared_arg_types[1]))
+ if (IsPolymorphicType(declared_arg_types[1]) ||
+ declared_arg_types[1] == RECORDOID)
{
/* assume the actual array type is OK */
res_atypeId = atypeId;