pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Murat Tuncer <mtuncer@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: BUG #14759: insert into foreign data partitions fail
Date: Tue, 1 Aug 2017 10:18:27 +0900
Message-ID: <b19a8e2b-e000-f592-3e0b-3e90ba0fa816@lab.ntt.co.jp> (raw)
In-Reply-To: <CAKFQuwZNxLfpsUPMs82m+t-Z3Oa45jVREjLqima5GOx3DK7NrQ@mail.gmail.com>
References: <20170724212815.1456.54156@wrigleys.postgresql.org>
	<7a8c22cd-3330-753b-1c3a-e95f64908179@lab.ntt.co.jp>
	<CAKFQuwbDLnwd7U2v6rmTP_W3GwsG16SNWRa570XXM5dMo0qpLA@mail.gmail.com>
	<b2ad4cb7-0b6c-8d75-e7cd-8e709c22e714@lab.ntt.co.jp>
	<CAKFQuwYrSQHv5zaTUDQuno0NzqHAXTzX3DrE2HtmjcJJt8nS5g@mail.gmail.com>
	<a44d3061-a413-22a4-50fc-b6a2c96b91e9@lab.ntt.co.jp>
	<CAKFQuwZNxLfpsUPMs82m+t-Z3Oa45jVREjLqima5GOx3DK7NrQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2017/08/01 10:10, David G. Johnston wrote:
> On Mon, Jul 31, 2017 at 5:42 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp
>> wrote:
> 
>>
>> On a second thought though, I think we should list the foreign table
>> partitions' limitations in only one place, that is, the CREATE FOREIGN
>> TABLE reference page.  Listing them under 5.10.2.3. seems a bit off to me,
>> because other limitations listed there are those of the new partitioned
>> table objects, such as lack of global index constraints, etc.  Lack of
>> tuple-routing to foreign partitions does not seem to me of the similar
>> nature.  Also, the same text is no longer repeated in 3 different places.
>>
>> Thoughts on the updated patch?
>>
> 
> Overall, works for me.
> 
> grammar (add a couple of commas for flow) and style (dropping the first
> "the")
> 
> current: "(both the user-defined constraints such as <literal>CHECK</> or
> <literal>NOT NULL</> clauses and the partition constraint)"
> proposed: "(both user-defined constraints, such as <literal>CHECK</> or
> <literal>NOT NULL</> clauses, and the partition constraint)"

Good points; fixed in the updated patch.

Thanks,
Amit

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

0001-Clarify-that-partition-constraint-is-not-enforced-on-v4.patch (text/plain, 3.2K) download From a5b75278a6dab39c5cd7a95a746c28ed8d5f1bbc Mon Sep 17 00:00:00 2001 From: amit <amitlangote09@gmail.com> Date: Mon, 3 Apr 2017 16:45:15 +0900 Subject: [PATCH] Clarify that partition constraint is not enforced on foreign tables --- doc/src/sgml/ddl.sgml | 8 +++----- doc/src/sgml/ref/create_foreign_table.sgml | 17 +++++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index b05a9c2150..a707c3e22a 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -2986,11 +2986,9 @@ VALUES ('Albany', NULL, NULL, 'NY'); </para> <para> - Partitions can also be foreign tables - (see <xref linkend="sql-createforeigntable">), - although these have some limitations that normal tables do not. For - example, data inserted into the partitioned table is not routed to - foreign table partitions. + Partitions can also be foreign tables, although they have some limitations + that normal tables do not; see <xref linkend="sql-createforeigntable"> for + more information. </para> <sect3 id="ddl-partitioning-declarative-example"> diff --git a/doc/src/sgml/ref/create_foreign_table.sgml b/doc/src/sgml/ref/create_foreign_table.sgml index 065c982082..594f75e112 100644 --- a/doc/src/sgml/ref/create_foreign_table.sgml +++ b/doc/src/sgml/ref/create_foreign_table.sgml @@ -79,7 +79,9 @@ CHECK ( <replaceable class="PARAMETER">expression</replaceable> ) [ NO INHERIT ] <para> If <literal>PARTITION OF</literal> clause is specified then the table is created as a partition of <literal>parent_table</literal> with specified - bounds. + bounds. Note that routing tuples to partitions that are foreign tables + is not supported. So, if a tuple inserted (or copied) into the table + routes to one of the foreign partitions, an error will occur. </para> <para> @@ -279,16 +281,19 @@ CHECK ( <replaceable class="PARAMETER">expression</replaceable> ) [ NO INHERIT ] <title>Notes</title> <para> - Constraints on foreign tables (such as <literal>CHECK</> - or <literal>NOT NULL</> clauses) are not enforced by the - core <productname>PostgreSQL</> system, and most foreign data wrappers - do not attempt to enforce them either; that is, the constraint is + Constraints (both user-defined constraints, such as <literal>CHECK</> + or <literal>NOT NULL</> clauses, and the partition constraint) are not + enforced by the core <productname>PostgreSQL</> system, and most foreign + data wrappers do not attempt to enforce them either; that is, they are simply assumed to hold true. There would be little point in such enforcement since it would only apply to rows inserted or updated via the foreign table, and not to rows modified by other means, such as directly on the remote server. Instead, a constraint attached to a foreign table should represent a constraint that is being enforced by - the remote server. + the remote server. That becomes especially important if the table is + being used in a partition hierarchy, where it is recommended to add + a constraint matching the partition constraint expression on + the remote table. </para> <para> -- 2.11.0

view thread (12+ messages)  latest in thread

Message-ID: <b19a8e2b-e000-f592-3e0b-3e90ba0fa816@lab.ntt.co.jp>
Permalink:  ../b19a8e2b-e000-f592-3e0b-3e90ba0fa816@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/b19a8e2b-e000-f592-3e0b-3e90ba0fa816@lab.ntt.co.jp

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: Langote_Amit_f8@lab.ntt.co.jp, david.g.johnston@gmail.com, mtuncer@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: BUG #14759: insert into foreign data partitions fail
  In-Reply-To: <b19a8e2b-e000-f592-3e0b-3e90ba0fa816@lab.ntt.co.jp>
  References: <20170724212815.1456.54156@wrigleys.postgresql.org> <7a8c22cd-3330-753b-1c3a-e95f64908179@lab.ntt.co.jp> <CAKFQuwbDLnwd7U2v6rmTP_W3GwsG16SNWRa570XXM5dMo0qpLA@mail.gmail.com> <b2ad4cb7-0b6c-8d75-e7cd-8e709c22e714@lab.ntt.co.jp> <CAKFQuwYrSQHv5zaTUDQuno0NzqHAXTzX3DrE2HtmjcJJt8nS5g@mail.gmail.com> <a44d3061-a413-22a4-50fc-b6a2c96b91e9@lab.ntt.co.jp> <CAKFQuwZNxLfpsUPMs82m+t-Z3Oa45jVREjLqima5GOx3DK7NrQ@mail.gmail.com> <b19a8e2b-e000-f592-3e0b-3e90ba0fa816@lab.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox