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 1hAqtG-00084a-CE for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Apr 2019 06:57:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAqtE-0004KA-Ew for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Apr 2019 06:57:52 +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 1hAqtE-0004K2-7U for pgsql-bugs@lists.postgresql.org; Mon, 01 Apr 2019 06:57:52 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAqtB-0003YX-P0 for pgsql-bugs@lists.postgresql.org; Mon, 01 Apr 2019 06:57:51 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x316vkeQ002005; Mon, 1 Apr 2019 15:57:46 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 4D76C638EB8; Mon, 1 Apr 2019 15:57:46 +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 41DE1638D16; Mon, 1 Apr 2019 15:57:46 +0900 (JST) Received: from [IPv6:::1] (unknown [129.60.241.75]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 3B1D240028E; Mon, 1 Apr 2019 15:57:46 +0900 (JST) Message-ID: <5CA1B659.1050908@lab.ntt.co.jp> Date: Mon, 01 Apr 2019 15:57:29 +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: BUG #15724: Can't create foreign table as partition References: <20190329141050.GA22336@alvherre.pgsql> <5CA1A320.4050707@lab.ntt.co.jp> <038a0fec-6684-c654-bade-bcf80cb8daad@lab.ntt.co.jp> In-Reply-To: <038a0fec-6684-c654-bade-bcf80cb8daad@lab.ntt.co.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Amit Langote Cc: Alvaro Herrera , Tom Lane , stepya@ukr.net, pgsql-bugs@lists.postgresql.org X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk (2019/04/01 15:23), Amit Langote wrote: > On 2019/04/01 14:35, Etsuro Fujita wrote: >> (2019/03/29 23:10), Alvaro Herrera wrote: >>> On 2019-Mar-29, Tom Lane wrote: >>> >>>> Alvaro Herrera writes: >>>>> On 2019-Mar-29, PG Bug reporting form wrote: >>>>>> SQL Error [42809]: ERROR: cannot create index on foreign table >>>>>> "msg_json" >> >>>> Really, what *ought* to happen in such a case is that the FDW gets >>>> told about the command and has the opportunity to try to do something >>>> corresponding to making an index. >> >> Interesting! > > +1 > > Maybe, CHECK constraints on foreign tables are similar -- it merely > asserts the condition that all of the rows in the remote table *must* > satisfy so that the local server can do something useful with it, such as > trying to exclude the table with constraint exclusion. > > I guess the intended benefit with allowing indexes would be similar -- a > locally-defined index on a foreign table will help an FDW estimate the > cost of a query accessing the table more efficiently than, for example, > having to rely on some other relatively expensive alternative, such as > use_remote_estimate in postgres_fdw's case. Yeah, I think so. Another benefit I can think of would be: that would probably allow us to support ON CONFLICT DO UPDATE for foreign tables. I think the intended benefit would be large! Best regards, Etsuro Fujita