Lists: | pgsql-bugs |
---|
From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | derek(dot)hans(at)gmail(dot)com |
Subject: | BUG #15662: Row update in foreign partition does not move row based on partition key |
Date: | 2019-03-01 19:06:48 |
Message-ID: | 15662-4b833b46c8a35fe7@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15662
Logged by: Derek Hans
Email address: derek(dot)hans(at)gmail(dot)com
PostgreSQL version: 11.2
Operating system: Debian 6.3.0-18+deb9u1
Description:
In a table with data partitions, updating the partition key of a row only
moves the row across partitions in some of the situations:
- From local partition to local partition
- From local partition to foreign partition
Rows are not moved
- From foreign partition to local partition
- From foreign partition to foreign partition
Repro steps:
Assumes 2 servers. 1st server has user postgres with password 'docker'
available at localhost:5432
-------------BOX 1
CREATE TABLE temperatures_2016 (
at date,
city text,
mintemp integer,
maxtemp integer
);
-------------BOX 2
CREATE TABLE temperatures (
at date,
city text,
mintemp integer,
maxtemp integer
)
PARTITION BY RANGE (at);
CREATE TABLE temperatures_2017
PARTITION OF temperatures
FOR VALUES FROM ('2017-01-01') TO ('2018-01-01');
CREATE EXTENSION postgres_fdw;
CREATE SERVER box1 FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'localhost', dbname 'postgres', port '5432');
CREATE USER MAPPING FOR postgres SERVER box1
OPTIONS (user 'postgres', password 'docker');
CREATE FOREIGN TABLE temperatures_2016
PARTITION OF temperatures
FOR VALUES FROM ('2016-01-01') TO ('2017-01-01')
SERVER box1;
INSERT INTO temperatures (at, city, mintemp, maxtemp) VALUES ('2016-08-03',
'London', 63, 73);
UPDATE temperatures set at = '2017-01-02';
SELECT * from temperatures_2017;
-----------------------
EXPECTED OUTPUT:
"2017-01-02" "London" 63 73
ACTUAL OUTPUT:
no data.
Running
SELECT * from temperatures_2016;
does output the expected row - i.e. the row remains in the partition where
it was created.
From: | Sergei Kornilov <sk(at)zsrv(dot)org> |
---|---|
To: | "derek(dot)hans(at)gmail(dot)com" <derek(dot)hans(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15662: Row update in foreign partition does not move row based on partition key |
Date: | 2019-03-01 19:54:00 |
Message-ID: | 14728891551470040@iva5-cb9df376e345.qloud-c.yandex.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Hello
This is known limitation and documented in the notes section of the UPDATE reference page:
> "Currently, rows cannot be moved from a partition that is a foreign table to some other partition, but they can be moved into a foreign table if the foreign data wrapper supports it."
regards, Sergei
From: | Derek Hans <derek(dot)hans(at)gmail(dot)com> |
---|---|
To: | Sergei Kornilov <sk(at)zsrv(dot)org> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15662: Row update in foreign partition does not move row based on partition key |
Date: | 2019-03-04 13:57:48 |
Message-ID: | CAGrP7a2vkbuu5RLd4yC4TP7nwpTbqLt5pfpS5a7-decy7yxq3w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Thanks. That's a substantial limitation.
I looked pretty hard through the various pieces of documentation and
tutorials and saw no mention. The v11 release notes don't mention it
either. Might be worth adding to the docs in more places and more
prominently.
On Fri, Mar 1, 2019 at 2:54 PM Sergei Kornilov <sk(at)zsrv(dot)org> wrote:
> Hello
>
> This is known limitation and documented in the notes section of the UPDATE
> reference page:
>
> > "Currently, rows cannot be moved from a partition that is a foreign
> table to some other partition, but they can be moved into a foreign table
> if the foreign data wrapper supports it."
>
> /docs/11/sql-update.html
>
> regards, Sergei
>
--
*Derek*
+1 (415) 754-0519 | derek(dot)hans(at)gmail(dot)com | Skype: derek.hans
From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Derek Hans <derek(dot)hans(at)gmail(dot)com> |
Cc: | Sergei Kornilov <sk(at)zsrv(dot)org>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15662: Row update in foreign partition does not move row based on partition key |
Date: | 2019-03-04 15:12:25 |
Message-ID: | CA+HiwqF3gma5HfCJb4_cOk0_+LEpVc57EHdBfz_EKt+Nu0hNYg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Hi,
On Mon, Mar 4, 2019 at 10:58 PM Derek Hans <derek(dot)hans(at)gmail(dot)com> wrote:
>
> Thanks. That's a substantial limitation.
>
> I looked pretty hard through the various pieces of documentation and tutorials and saw no mention. The v11 release notes don't mention it either. Might be worth adding to the docs in more places and more prominently.
Perhaps, it would make sense to make a note related to this in the
partitioning chapter where various limitations are listed and link to
it from the v11 release notes.
I've attached a patch. It applies to the PG 11 stable branch, but the
ddl.sgml part of the patch should also be applied to master.
Thanks,
Amit
Attachment | Content-Type | Size |
---|---|---|
document-update-row-movement-limitation.patch | application/octet-stream | 1.3 KB |