Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1PrX-0000u0-Ln for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2019 06:17:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1PrV-0007Ky-Lo for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2019 06:17:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1PrV-0007Kr-EJ for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2019 06:17:05 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1PrS-0002pq-4e for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2019 06:17:04 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x266GvY3018933; Wed, 6 Mar 2019 15:16:57 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 7F75B638B8A; Wed, 6 Mar 2019 15:16:57 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 6F1D0638B48; Wed, 6 Mar 2019 15:16:57 +0900 (JST) Received: from [IPv6:::1] (unknown [129.60.241.75]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 47BE7400879; Wed, 6 Mar 2019 15:16:57 +0900 (JST) Message-ID: <5C7F65B9.9050804@lab.ntt.co.jp> Date: Wed, 06 Mar 2019 15:16:25 +0900 From: Etsuro Fujita User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Subject: Re: Update does not move row across foreign partitions in v11 References: <20190227193114.GA19279@alvherre.pgsql> <5C7F3E94.2060101@lab.ntt.co.jp> <2396e176-ede8-cfbc-d012-fdb7a7e8b1f0@lab.ntt.co.jp> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Amit Langote Cc: David Rowley , PostgreSQL Hackers , Robert Haas , Alvaro Herrera , Derek Hans X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk (2019/03/06 13:53), Amit Langote wrote: > On 2019/03/06 13:30, David Rowley wrote: >> I think you missed my point. If there's no special support for "tuple >> moving", as you say, then what help is it to tell the user "if the FDW >> supports tuple routing"? The answer is, it's not any help. How would >> the user check such a fact? > > Hmm, maybe getting the following error, like one would get in PG 10 when > using postgres_fdw-managed partitions: > > ERROR: cannot route inserted tuples to a foreign table > > Getting the above error is perhaps not the best way for a user to learn of > this fact, but maybe we (and hopefully other FDW authors) mention this in > the documentation? +1 >> As far as I can tell, this is just the requirements as defined in >> CheckValidResultRel() for CMD_INSERT. Fragments of which I pasted >> above. > > Only supporting INSERT doesn't suffice though. An FDW which intends to > support tuple routing and hence 1-way tuple moving needs to updated like > postgres_fdw was in PG 11. That's right; the "if the FDW supports it" in the documentation refers to the FDW's support for the callback functions BeginForeignInsert() and EndForeignInsert() described in 57.2.4. FDW Routines For Updating Foreign Tables [1] in addition to ExecForeignInsert(), as stated there: "Tuples inserted into a partitioned table by INSERT or COPY FROM are routed to partitions. If an FDW supports routable foreign-table partitions, it should also provide the following callback functions." Best regards, Etsuro Fujita [1] https://www.postgresql.org/docs/current/fdw-callbacks.html#FDW-CALLBACKS-UPDATE