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.
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) &&
---
(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
----
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
---
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
---
select * from only t1_1 order by 1;
a
---
- 5
+ 4
6
7
8