summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2017-08-28 10:03:47 +0000
committerPavan Deolasee2017-08-28 11:07:51 +0000
commitdbd9556cef9bf426bfd5e396f532d94a16860659 (patch)
tree5e4e8c0eb6ca6ac781c174604e0d05417df751c6
parent8e1fc9914c83e5cd4ba4799fe6b4fee7dcb619bb (diff)
Do not add any distribution to a dummy append node
A dummy append node with no subpaths doesn't need any adjustment for distribution. This allows us to actually correct handle UPDATE/DELETE in some cases which were failing earlier.
-rw-r--r--src/backend/optimizer/plan/planner.c3
-rw-r--r--src/test/regress/expected/rowsecurity.out5
-rw-r--r--src/test/regress/expected/rules.out4
3 files changed, 5 insertions, 7 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index ee6c50d7c0..cc4b06a292 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -6918,6 +6918,9 @@ adjust_path_distribution(PlannerInfo *root, Query *parse, Path *path)
if ((path->distribution == NULL) && (root->distribution == NULL))
return path;
+ if (IS_DUMMY_PATH(path))
+ return path;
+
if (equal_distributions(root, root->distribution, path->distribution))
{
if (IsLocatorReplicated(path->distribution->distributionType) &&
diff --git a/src/test/regress/expected/rowsecurity.out b/src/test/regress/expected/rowsecurity.out
index 000af55572..6a6492f3fb 100644
--- a/src/test/regress/expected/rowsecurity.out
+++ b/src/test/regress/expected/rowsecurity.out
@@ -3344,13 +3344,12 @@ UPDATE r2 SET a = 2 RETURNING *; -- Updates nothing
---
(0 rows)
-UPDATE 0
DELETE FROM r2 RETURNING *; -- Deletes nothing
a
---
(0 rows)
-DELETE 0
+-- r2 can be used as a non-target relation in DML
INSERT INTO r1 SELECT a + 1 FROM r2 RETURNING *; -- OK
a
----
@@ -3410,8 +3409,6 @@ INSERT INTO r1 VALUES (1);
ERROR: new row violates row-level security policy for table "r1"
-- No error (unable to see any rows to update)
UPDATE r1 SET a = 1;
-ERROR: could not plan this distributed update
-DETAIL: correlated UPDATE or updating distribution column currently not supported in Postgres-XL.
TABLE r1;
a
---
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index 499ffb31cd..8cc84adc8b 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -2676,8 +2676,6 @@ create rule t1_upd_2 as on update to t1
set constraint_exclusion = on;
insert into t1 select * from generate_series(5,19,1) g;
update t1 set a = 4 where a = 5;
-ERROR: could not plan this distributed update
-DETAIL: correlated UPDATE or updating distribution column currently not supported in Postgres-XL.
select * from only t1 order by 1;
a
---
@@ -2686,7 +2684,7 @@ select * from only t1 order by 1;
select * from only t1_1 order by 1;
a
---
- 5
+ 4
6
7
8