From: Pavan Deolasee Date: Mon, 28 Aug 2017 10:03:47 +0000 (+0530) Subject: Do not add any distribution to a dummy append node X-Git-Tag: XL_10_R1BETA1~145 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=dbd9556cef9bf426bfd5e396f532d94a16860659;p=postgres-xl.git 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. --- 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