Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 8621FB5DC4F for ; Thu, 3 Nov 2011 14:57:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 33862-02 for ; Thu, 3 Nov 2011 17:57:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 4F8A7B5DC46 for ; Thu, 3 Nov 2011 14:57:04 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id pA3Hv3dH052628 for ; Thu, 3 Nov 2011 17:57:03 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id pA3Hv3KT052627; Thu, 3 Nov 2011 17:57:03 GMT (envelope-from www) Date: Thu, 3 Nov 2011 17:57:03 GMT Message-Id: <201111031757.pA3Hv3KT052627@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6286: Table Partitioning - SQL/MED - interaction broken From: "Greg Fausak" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201111/26 X-Sequence-Number: 31621 The following bug has been logged online: Bug reference: 6286 Logged by: Greg Fausak Email address: greg@named.com PostgreSQL version: 9.1.1 Operating system: Linux Description: Table Partitioning - SQL/MED - interaction broken Details: I create a table partition: table M table A (check range) inherits M table B (check range) inherits M ... table X (check range) inherits M ASSERT: a query with constraint exclusions=on, performed on M will select the correct partitioned tables. Partitioning seems to work fine. Second part, create a foreign table that is a file: create server ES foreign data wrapper file_fdw; create foreign table Y ( columns like table M ) server ES options (format 'csv', file '/tmp/x', ...); ASSERT: a query against table Y (which has the same columns as table M) shows data file the file /tmp/x. Perfect, SQL/MED works. Here is the bug when trying to use the two together with a rule to bind them: create rule "_RETURN" as on select to X do instead select * from Y; If I select * from X that works fine. But, when I do a select from the partition table M, the EXPLAIN shows that table X is queried....but, the rule for select is not being fired in this context, and no data is returned from this partition. In other words, how do I partition a table when partitions can be external in the SQL/MED sense? Thanks, ---greg