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 1loMLR-0005zC-46 for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Jun 2021 08:35:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1loMLP-0003Qu-B0 for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Jun 2021 08:35:19 +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 1loMLP-0003Ql-1a for pgsql-hackers@lists.postgresql.org; Wed, 02 Jun 2021 08:35:19 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1loMLH-0006o8-TZ for pgsql-hackers@lists.postgresql.org; Wed, 02 Jun 2021 08:35:17 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 7F54221C806F; Wed, 2 Jun 2021 11:35:09 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1622622909; bh=sFvl/Vb+pC1LuM543kdzsKCBEOzKLgq8WbYJCy/9h+g=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=J78+bHuR2ZAumZ1a01yEWg0Ar8IVqj9zhyUw3bxQqUrMhiGYQ8caUu+zWGeWUWsEJ YoxQb9etteW+4B4qiRKhQcJGks6wahfCDBYNF/0k6JFd+rgiygaUhVpnNeYbvsk0j7 YvaprS6E+EJDaXP146GLXAhAU9wc0ubadFnrcsWE= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 02 Jun 2021 11:35:09 +0300 From: Alexander Pyhalov To: Tom Lane Cc: Amit Langote , PostgreSQL Hackers Subject: Re: join pushdown and issue with foreign update In-Reply-To: <2854976.1622583171@sss.pgh.pa.us> References: <7817fb9ebd6661cdf9b67dec6e129a78@postgrespro.ru> <050b90460c024dd21af53dbaaf8fd510@postgrespro.ru> <2845636.1622571541@sss.pgh.pa.us> <2854976.1622583171@sss.pgh.pa.us> User-Agent: Roundcube Webmail/1.4.0 Message-ID: X-Sender: a.pyhalov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tom Lane писал 2021-06-02 00:32: > I wrote: >> I think a preferable fix involves making sure that the correct >> record-type typmod is propagated to record_in in this context. >> Alternatively, maybe we could insert the foreign table's rowtype >> during execution of the input operation, without touching the >> plan as such. > > Here's a draft-quality patch based on that idea. It resolves > the offered test case, but I haven't beat on it beyond that. > > regards, tom lane Hi. The patch seems to work fine for mentioned case. For now I'm working on function pushdown. When record-returning function (like unnest()) is pushed down, on this stage we've already lost any type information, so get the issue again. So far I'm not sure how to fix the issue, perhaps just avoid pushing foreign join if we have record, corresponding to function RTE var in joinrel->reltarget? -- Best regards, Alexander Pyhalov, Postgres Professional