Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsX8q-002ty3-O6 for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Mar 2025 01:13:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tsX8o-00060g-Jl for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Mar 2025 01:13:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsX8o-0005yM-Ah for pgsql-bugs@lists.postgresql.org; Thu, 13 Mar 2025 01:13:42 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tsX8m-002WTp-1H for pgsql-bugs@lists.postgresql.org; Thu, 13 Mar 2025 01:13:41 +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 52D1DYTf2588245; Wed, 12 Mar 2025 21:13:35 -0400 From: Tom Lane To: Andres Freund cc: Dean Rasheed , Tender Wang , Duncan Sands , pgsql-bugs@lists.postgresql.org Subject: Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE In-reply-to: <2560748.1741824533@sss.pgh.pa.us> References: <971078.1741629162@sss.pgh.pa.us> <1207317.1741633880@sss.pgh.pa.us> <1213530.1741637326@sss.pgh.pa.us> <1620306.1741713271@sss.pgh.pa.us> <1638469.1741723564@sss.pgh.pa.us> <1834982.1741729881@sss.pgh.pa.us> <2160671.1741794569@sss.pgh.pa.us> <2560748.1741824533@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 12 Mar 2025 20:08:53 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2588243.1741828414.1@sss.pgh.pa.us> Date: Wed, 12 Mar 2025 21:13:34 -0400 Message-ID: <2588244.1741828414@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Ugh. I supposed that it was okay that 317aba70e etc. didn't touch > outfuncs/readfuncs, but I did not think of > -DWRITE_READ_PARSE_PLAN_TREES. > Perhaps a good hack to deal with that is to make setrefs.c clear > out relid for RTE_SUBQUERY RTEs in those branches. Then, in the > same way that the rte->function hack doesn't escape the planner, > this one wouldn't either. Double ugh: that doesn't fix it, because we also do a round of WRITE_READ_PARSE_PLAN_TREES checks on the rewriter output. Not sure how to fix this, unless we lobotomize that write/read check somehow. regards, tom lane