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 1loLUA-00046G-PA for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Jun 2021 07:40:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1loLTe-0004Yj-Aq for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Jun 2021 07:39:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loLTe-0004X9-1E for pgsql-hackers@lists.postgresql.org; Wed, 02 Jun 2021 07:39:46 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1loLTY-0005UA-IM for pgsql-hackers@lists.postgresql.org; Wed, 02 Jun 2021 07:39:44 +0000 Received: from [192.168.129.222] (unknown [94.25.177.206]) (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 2684A21C806F; Wed, 2 Jun 2021 10:39:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1622619578; bh=E5gglZeAYVHK6wN881VFnU2vs3iWlZMemgLNJMpFKHI=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=oUjuBi14JK0rHdiu9pbSx4ZSx4j0GitrUTS43WGaotT/r0mi1MKkhmjLbGzDsZ7Bm hhK7xml58CBXIVIyS88CuRVV+UoiDeu9bVBjM4crpSsQo51rx+lbcCi2irnS/F+FZI I8coxVQCelIs6lmRv/1ReuavC4q92CUoYngRQuhQ= Subject: Re: join pushdown and issue with foreign update To: Tom Lane , Alexander Pyhalov Cc: Amit Langote , PostgreSQL Hackers References: <7817fb9ebd6661cdf9b67dec6e129a78@postgrespro.ru> <050b90460c024dd21af53dbaaf8fd510@postgrespro.ru> <2845636.1622571541@sss.pgh.pa.us> <2854976.1622583171@sss.pgh.pa.us> From: Andrey Lepikhov Organization: Postgres Professional Message-ID: Date: Wed, 2 Jun 2021 12:39:37 +0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <2854976.1622583171@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/6/21 02:32, Tom Lane wrote: > 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 > I played with your patch and couldn't find any errors. But what if ROW operation were allowed to be pushed to a foreign server? Potentially, I can imagine pushed-down JOIN with arbitrary ROW function in its target list. Amit's approach looks more safe for me. -- regards, Andrey Lepikhov Postgres Professional