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 1hAqM1-0006ew-ID for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Apr 2019 06:23:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAqM0-0004Ws-5S for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Apr 2019 06:23:32 +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 1hAqLz-0004Ty-Sq for pgsql-bugs@lists.postgresql.org; Mon, 01 Apr 2019 06:23:31 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAqLx-0002gu-2L for pgsql-bugs@lists.postgresql.org; Mon, 01 Apr 2019 06:23:31 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x316NPc6026911; Mon, 1 Apr 2019 15:23:25 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id D3BE3EA7C87; Mon, 1 Apr 2019 15:23:25 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id C937BEA7F8D; Mon, 1 Apr 2019 15:23:25 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id BC40D40028E; Mon, 1 Apr 2019 15:23:25 +0900 (JST) Subject: Re: BUG #15724: Can't create foreign table as partition References: <20190329141050.GA22336@alvherre.pgsql> <5CA1A320.4050707@lab.ntt.co.jp> From: Amit Langote Message-ID: <038a0fec-6684-c654-bade-bcf80cb8daad@lab.ntt.co.jp> Date: Mon, 1 Apr 2019 15:23:15 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <5CA1A320.4050707@lab.ntt.co.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CC-Mail-RelayStamp: 1 To: Etsuro Fujita , Alvaro Herrera Cc: 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 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. Thanks, Amit