From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Derek Hans <derek.hans@gmail.com>
Subject: Re: Update does not move row across foreign partitions in v11
Date: Fri, 08 Mar 2019 20:09:23 +0900
Message-ID: <5C824D63.4040601@lab.ntt.co.jp> (raw)
In-Reply-To: <CAKJS1f8QVfQHAPfkJ3P1iaN=DRVgYMce6jSHH41e3MN+10iMsw@mail.gmail.com>
References: <CAGrP7a3Xc1Qy_B2WJcgAD8uQTS_NDcJn06O5mtS_Ne1nYhBsyw@mail.gmail.com>
<20190227193114.GA19279@alvherre.pgsql>
<CAGrP7a0VhvM23m_kSsXUc1iAj4Z5DkyBaqq=fhxAS8VxNaFZ5w@mail.gmail.com>
<CAKJS1f-kwK71B8TV7tbe5dpbhVvR-7J5TqHCiQkw8pbwdwD-dw@mail.gmail.com>
<e8281e87-c5e6-25d3-f92e-e850c27c76e9@lab.ntt.co.jp>
<CAKJS1f9RGnd=fdEKWqyS3OBBUsR1Roy4wJmzadGhRe=Qf2_0LQ@mail.gmail.com>
<14069ba3-20bb-529b-f104-4e282dc3e322@lab.ntt.co.jp>
<5C7F46CC.6010801@lab.ntt.co.jp>
<396fc4ca-eeba-e8af-cd72-90861469d3da@lab.ntt.co.jp>
<5C7F645E.2080805@lab.ntt.co.jp>
<16381946-c020-7099-f8fc-f5a8e11d6fb5@lab.ntt.co.jp>
<5C810FF7.8010802@lab.ntt.co.jp>
<e8269ccf-ad98-9c59-6bae-2c44c900c12e@lab.ntt.co.jp>
<CAKJS1f8QVfQHAPfkJ3P1iaN=DRVgYMce6jSHH41e3MN+10iMsw@mail.gmail.com>
(2019/03/08 19:29), David Rowley wrote:
> On Fri, 8 Mar 2019 at 15:07, Amit Langote<Langote_Amit_f8@lab.ntt.co.jp> wrote:
>> David, can you confirm if the rewritten text reads unambiguous or perhaps
>> suggest a better wording?
>
> So this is the text:
>
> + Currently, rows cannot be moved from a foreign-table partition to some
> + other partition, but they can be moved into a foreign-table partition if
> + the foreign data wrapper supports tuple routing.
>
> I read this to mean that rows cannot normally be moved out of a
> foreign-table partition unless the new partition is a foreign one that
> uses an FDW that supports tuple routing.
>
> So let's test that:
>
> create extension postgres_fdw ;
> do $$ begin execute 'create server loopback foreign data wrapper
> postgres_fdw options (dbname ''' || current_database() || ''');'; end;
> $$;
> create user mapping for current_user server loopback;
>
> create table listp (a int) partition by list (a);
> create table listp1 (a int, check (a = 1));
> create table listp2 (a int, check (a = 2));
>
> create foreign table listpf1 partition of listp for values in (1)
> server loopback options (table_name 'listp1');
> create foreign table listpf2 partition of listp for values in (2)
> server loopback options (table_name 'listp2');
>
> insert into listp values (1);
>
> update listp set a = 2 where a = 1;
> ERROR: new row for relation "listp1" violates check constraint "listp1_a_check"
> DETAIL: Failing row contains (2).
> CONTEXT: remote SQL command: UPDATE public.listp1 SET a = 2 WHERE ((a = 1))
>
> I'd be filing a bug report for that as I'm moving a row into a foreign
> table with an FDW that supports tuple routing.
Fair enough.
> Where I think you're going wrong is, in one part of the sentence
> you're talking about UPDATE, then in the next part you seem to
> magically jump to talking about INSERT. Since the entire paragraph is
> talking about UPDATE, why is it relevant to talk about INSERT?
>
> I thought my doc_confirm_foreign_partition_limitations.patch had this
> pretty clear with:
>
> +<listitem>
> +<para>
> + Currently, an<command>UPDATE</command> of a partitioned table cannot
> + move rows out of a foreign partition into another partition.
> +</para>
> +</listitem>
>
> Or is my understanding of this incorrect?
IMO I think it's better that we also mention that the UPDATE can move
rows into a foreign partition if the FDW supports it. No?
> I also think the new
> paragraph is a good move as it's a pretty restrictive limitation for
> anyone that wants to set up a partition hierarchy with foreign
> partitions.
+1
Best regards,
Etsuro Fujita
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-general@postgresql.org
Cc: fujita.etsuro@lab.ntt.co.jp, david.rowley@2ndquadrant.com, Langote_Amit_f8@lab.ntt.co.jp, pgsql-hackers@lists.postgresql.org, robertmhaas@gmail.com, alvherre@2ndquadrant.com, derek.hans@gmail.com
Subject: Re: Update does not move row across foreign partitions in v11
In-Reply-To: <5C824D63.4040601@lab.ntt.co.jp>
References: <CAGrP7a3Xc1Qy_B2WJcgAD8uQTS_NDcJn06O5mtS_Ne1nYhBsyw@mail.gmail.com> <20190227193114.GA19279@alvherre.pgsql> <CAGrP7a0VhvM23m_kSsXUc1iAj4Z5DkyBaqq=fhxAS8VxNaFZ5w@mail.gmail.com> <CAKJS1f-kwK71B8TV7tbe5dpbhVvR-7J5TqHCiQkw8pbwdwD-dw@mail.gmail.com> <e8281e87-c5e6-25d3-f92e-e850c27c76e9@lab.ntt.co.jp> <CAKJS1f9RGnd=fdEKWqyS3OBBUsR1Roy4wJmzadGhRe=Qf2_0LQ@mail.gmail.com> <14069ba3-20bb-529b-f104-4e282dc3e322@lab.ntt.co.jp> <5C7F46CC.6010801@lab.ntt.co.jp> <396fc4ca-eeba-e8af-cd72-90861469d3da@lab.ntt.co.jp> <5C7F645E.2080805@lab.ntt.co.jp> <16381946-c020-7099-f8fc-f5a8e11d6fb5@lab.ntt.co.jp> <5C810FF7.8010802@lab.ntt.co.jp> <e8269ccf-ad98-9c59-6bae-2c44c900c12e@lab.ntt.co.jp> <CAKJS1f8QVfQHAPfkJ3P1iaN=DRVgYMce6jSHH41e3MN+10iMsw@mail.gmail.com> <5C824D63.4040601@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