Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1qtF-0005lv-8W for pgsql-general@arkaria.postgresql.org; Thu, 16 Jun 2022 14:54:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o1qtD-0006mJ-Hd for pgsql-general@arkaria.postgresql.org; Thu, 16 Jun 2022 14:54:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1qtD-0006mA-7C for pgsql-general@lists.postgresql.org; Thu, 16 Jun 2022 14:54:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1qtA-000126-S8 for pgsql-general@lists.postgresql.org; Thu, 16 Jun 2022 14:54:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 25GEsRIu913266; Thu, 16 Jun 2022 10:54:27 -0400 From: Tom Lane To: "David G. Johnston" cc: Bryn Llewellyn , pgsql-general list Subject: Re: ERROR: failed to find conversion function from key_vals_nn to record[] In-reply-to: References: <37D76918-6FD7-4598-A409-A7091687D8E6@yugabyte.com> Comments: In-reply-to "David G. Johnston" message dated "Wed, 15 Jun 2022 20:13:42 -0700" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <913086.1655391178.0@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 16 Jun 2022 10:54:27 -0400 Message-ID: <913265.1655391267@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="UTF-8" Content-ID: <913086.1655391178.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit "David G. Johnston" 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 ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="treat-RECORD-as-polymorphic-in-ScalarArray-Op-1.patch"; charset="us-ascii" Content-ID: <913086.1655391178.2@sss.pgh.pa.us> Content-Description: treat-RECORD-as-polymorphic-in-ScalarArray-Op-1.patch 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; ------- =_aaaaaaaaaa0--