Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W6Jsw-0004S0-VV for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2014 12:59:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W6Jsw-00056N-DR for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2014 12:59:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W6Jsu-00054M-6X for pgsql-hackers@postgresql.org; Thu, 23 Jan 2014 12:59:52 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W6Jsr-00027c-CP for pgsql-hackers@postgresql.org; Thu, 23 Jan 2014 12:59:51 +0000 Received: from mfs5.rdh.ecl.ntt.co.jp (mfs5.rdh.ecl.ntt.co.jp [129.60.39.144]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id s0NCxlcD031854; Thu, 23 Jan 2014 21:59:47 +0900 Received: from mfs5.rdh.ecl.ntt.co.jp (localhost.localdomain [127.0.0.1]) by mfs5.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id DC74BE011A; Thu, 23 Jan 2014 21:59:46 +0900 (JST) Received: from imail3.m.ecl.ntt.co.jp (imail3.m.ecl.ntt.co.jp [129.60.5.248]) by mfs5.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id D09DFE0119; Thu, 23 Jan 2014 21:59:46 +0900 (JST) Received: from [129.60.241.254] ([129.60.241.254]) by imail3.m.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id s0NCxk6H003091; Thu, 23 Jan 2014 21:59:46 +0900 Message-ID: <52E11225.2080907@lab.ntt.co.jp> Date: Thu, 23 Jan 2014 21:59:17 +0900 From: Etsuro Fujita User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: shigeru.hanada@gmail.com CC: pgsql-hackers@postgresql.org Subject: [Review] inherit support for foreign tables Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-TM-AS-MML: No X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Shigeru Hanada wrote: > Attached patch allows a foreign table to be a child of a table. It > also allows foreign tables to have CHECK constraints. Sorry for the delay. I started to look at this patch. > Though this would be debatable, in current implementation, constraints > defined on a foreign table (now only NOT NULL and CHECK are supported) > are not enforced during INSERT or UPDATE executed against foreign > tables. This means that retrieved data might violates the constraints > defined on local side. This is debatable issue because integrity of > data is important for DBMS, but in the first cut, it is just > documented as a note. I agree with you, but we should introduce a new keyword such as ASSERTIVE or something in 9.4, in preparation for the enforcement of constraints on the local side in a future release? What I'm concerned about is, otherwise, users will have to rewrite those DDL queries at that point. No? > Because I don't see practical case to have a foreign table as a > parent, and it avoid a problem about recursive ALTER TABLE operation, > foreign tables can't be a parent. I agree with you on that point. > For other commands recursively processed such as ANALYZE, foreign > tables in the leaf of inheritance tree are ignored. I'm not sure that in the processing of the ANALYZE command, we should ignore child foreign tables. It seems to me that the recursive processing is not that hard. Rather what I'm concerned about is that if the recursive processing is allowed, then autovacuum will probably have to access to forign tables on the far side in order to acquire those sample rows. It might be undesirable from the viewpoint of security or from the viewpoint of efficiency. --- a/doc/src/sgml/ref/create_foreign_table.sgml +++ b/doc/src/sgml/ref/create_foreign_table.sgml @@ -22,6 +22,7 @@ CREATE FOREIGN TABLE [ IF NOT EXISTS ] table_name column_name data_type [ OPTIONS ( option 'value' [, ... ] ) ] [ COLLATE collation ] [ column_constraint [ ... ] ] [, ... ] ] ) +[ INHERITS ( parent_table [, ... ] ) ] SERVER server_name [ OPTIONS ( option 'value' [, ... ] ) ] @@ -159,6 +160,17 @@ CREATE FOREIGN TABLE [ IF NOT EXISTS ] table_name + parent_table + + + The name of an existing table or foreign table from which the new foreign + table automatically inherits all columns, see + for details of table inheritance. + + + Correct? I think we should not allow a foreign table to be a parent. I'll look at this patch more closely. Thanks, Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers