ERROR: FOR SHARE is not allowed with joins
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2 for share of t2;
ERROR: FOR SHARE is not allowed with joins
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val = t2.val) for share;
+ERROR: FOR SHARE is not allowed with joins
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 left join t2 on (t1.val = t2.val) for share;
+ERROR: FOR SHARE is not allowed with joins
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 right join t2 on (t1.val = t2.val) for share;
+ERROR: FOR SHARE is not allowed with joins
+select * from t1 join t2 on (t1.val = t2.val) for share;
+ERROR: FOR SHARE is not allowed with joins
+select * from t1 left join t2 on (t1.val = t2.val) for share;
+ERROR: FOR SHARE is not allowed with joins
+select * from t1 right join t2 on (t1.val = t2.val) for share;
+ERROR: FOR SHARE is not allowed with joins
-- three table case
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2, t3;
QUERY PLAN
ERROR: FOR UPDATE is not allowed with joins
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2, t3 for share of t1,t2 nowait;
ERROR: FOR SHARE is not allowed with joins
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2);
+ QUERY PLAN
+---------------------------------------------------------------------
+ Remote Subquery Scan on all
+ Output: t1.val, t1.val2, t2.val, t2.val2, t3.val, t3.val2
+ -> Merge Join
+ Output: t1.val, t1.val2, t2.val, t2.val2, t3.val, t3.val2
+ Merge Cond: (t3.val2 = t1.val2)
+ -> Remote Subquery Scan on all
+ Output: t3.val, t3.val2
+ Distribute results by H: val2
+ -> Sort
+ Output: t3.val, t3.val2
+ Sort Key: t3.val2
+ -> Seq Scan on public.t3
+ Output: t3.val, t3.val2
+ -> Materialize
+ Output: t1.val, t1.val2, t2.val, t2.val2
+ -> Merge Join
+ Output: t1.val, t1.val2, t2.val, t2.val2
+ Merge Cond: (t1.val2 = t2.val2)
+ -> Remote Subquery Scan on all
+ Output: t1.val, t1.val2
+ Distribute results by H: val2
+ -> Sort
+ Output: t1.val, t1.val2
+ Sort Key: t1.val2
+ -> Seq Scan on public.t1
+ Output: t1.val, t1.val2
+ -> Materialize
+ Output: t2.val, t2.val2
+ -> Remote Subquery Scan on all
+ Output: t2.val, t2.val2
+ Distribute results by H: val2
+ -> Sort
+ Output: t2.val, t2.val2
+ Sort Key: t2.val2
+ -> Seq Scan on public.t2
+ Output: t2.val, t2.val2
+(36 rows)
+
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update;
+ERROR: FOR UPDATE is not allowed with joins
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1;
+ERROR: FOR UPDATE is not allowed with joins
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1,t3;
+ERROR: FOR UPDATE is not allowed with joins
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2);
+ val | val2 | val | val2 | val | val2
+-----+------+-----+------+-----+------
+ 1 | 11 | 3 | 11 | 5 | 11
+ 1 | 11 | 4 | 11 | 5 | 11
+ 2 | 11 | 3 | 11 | 5 | 11
+ 2 | 11 | 4 | 11 | 5 | 11
+ 1 | 11 | 3 | 11 | 6 | 11
+ 1 | 11 | 4 | 11 | 6 | 11
+ 2 | 11 | 3 | 11 | 6 | 11
+ 2 | 11 | 4 | 11 | 6 | 11
+(8 rows)
+
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update;
+ERROR: FOR UPDATE is not allowed with joins
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1;
+ERROR: FOR UPDATE is not allowed with joins
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1,t3;
+ERROR: FOR UPDATE is not allowed with joins
-- check a few subquery cases
explain (costs off, num_nodes off, nodes off, verbose on) select * from (select * from t1 for update of t1 nowait) as foo;
QUERY PLAN
(8 rows)
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 where val in (select val from t2 for update of t2 nowait) for update;
- QUERY PLAN
-------------------------------------------------------------------------------
- Remote Subquery Scan on all
- Output: t1.val, t1.val2, t1.ctid, "ANY_subquery".*
- -> LockRows
- Output: t1.val, t1.val2, t1.ctid, "ANY_subquery".*
- -> Hash Join
- Output: t1.val, t1.val2, t1.ctid, "ANY_subquery".*
- Hash Cond: (t1.val = "ANY_subquery".val)
- -> Seq Scan on public.t1
- Output: t1.val, t1.val2, t1.ctid
- -> Hash
- Output: "ANY_subquery".*, "ANY_subquery".val
- -> HashAggregate
- Output: "ANY_subquery".*, "ANY_subquery".val
- Group Key: "ANY_subquery".val
- -> Subquery Scan on "ANY_subquery"
- Output: "ANY_subquery".*, "ANY_subquery".val
- -> LockRows
- Output: t2.val, t2.ctid
- -> Seq Scan on public.t2
- Output: t2.val, t2.ctid
-(20 rows)
-
+ERROR: FOR UPDATE is not allowed with joins
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 where val in (select val from t2 for update of t2 nowait);
QUERY PLAN
---------------------------------------------------------------
(2 rows)
select * from t1 where val in (select val from t2 for update of t2 nowait) for update;
- val | val2
------+------
-(0 rows)
-
+ERROR: FOR UPDATE is not allowed with joins
select * from t1 where val in (select val from t2 for update of t2 nowait);
val | val2
-----+------
-- ****
begin;
select * from t1, t2, t3 order by 1 for update;
-ERROR: FOR UPDATE is not allowed with joins
+ val | val2 | val | val2 | val | val2
+-----+------+-----+------+-----+------
+ 1 | 11 | 3 | 11 | 5 | 11
+ 1 | 11 | 3 | 11 | 6 | 11
+ 1 | 11 | 4 | 11 | 5 | 11
+ 1 | 11 | 4 | 11 | 6 | 11
+ 2 | 11 | 3 | 11 | 5 | 11
+ 2 | 11 | 3 | 11 | 6 | 11
+ 2 | 11 | 4 | 11 | 5 | 11
+ 2 | 11 | 4 | 11 | 6 | 11
+(8 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
--WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
-- ****
begin;
select * from t1, t2 where t1.val = t2.val for share;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+(0 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from t1, t2 for share of t2;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+ 1 | 11 | 3 | 11
+ 1 | 11 | 4 | 11
+ 2 | 11 | 3 | 11
+ 2 | 11 | 4 | 11
+(4 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from (select * from t1 for update of t1 nowait) as foo;
-- ****
begin;
select * from t1, t2 for share of t2 for update of t1;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+ 1 | 11 | 3 | 11
+ 1 | 11 | 4 | 11
+ 2 | 11 | 3 | 11
+ 2 | 11 | 4 | 11
+(4 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from t1 for share of t1 for update of t1;
-- ****
begin;
select * from t1 a,t1 b for share of a for update of b;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+ 1 | 11 | 1 | 11
+ 1 | 11 | 2 | 11
+ 2 | 11 | 1 | 11
+ 2 | 11 | 2 | 11
+(4 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from p1 order by 1 for update;
-- ****
begin;
select * from t1, t2, t3 order by 1 for update;
-ERROR: FOR UPDATE is not allowed with joins
+ val | val2 | val | val2 | val | val2
+-----+------+-----+------+-----+------
+ 1 | 11 | 3 | 11 | 5 | 11
+ 1 | 11 | 3 | 11 | 6 | 11
+ 1 | 11 | 4 | 11 | 5 | 11
+ 1 | 11 | 4 | 11 | 6 | 11
+ 2 | 11 | 3 | 11 | 5 | 11
+ 2 | 11 | 3 | 11 | 6 | 11
+ 2 | 11 | 4 | 11 | 5 | 11
+ 2 | 11 | 4 | 11 | 6 | 11
+(8 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
--WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
-- ****
begin;
select * from t1, t2 where t1.val = t2.val for share;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+(0 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from t1, t2 for share of t2;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+ 1 | 11 | 3 | 11
+ 1 | 11 | 4 | 11
+ 2 | 11 | 3 | 11
+ 2 | 11 | 4 | 11
+(4 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from (select * from t1 for update of t1 nowait) as foo;
-- ****
begin;
select * from t1, t2 for share of t2 for update of t1;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+ 1 | 11 | 3 | 11
+ 1 | 11 | 4 | 11
+ 2 | 11 | 3 | 11
+ 2 | 11 | 4 | 11
+(4 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from t1 for share of t1 for update of t1;
-- ****
begin;
select * from t1 a,t1 b for share of a for update of b;
-ERROR: FOR SHARE is not allowed with joins
+ val | val2 | val | val2
+-----+------+-----+------
+ 1 | 11 | 1 | 11
+ 1 | 11 | 2 | 11
+ 2 | 11 | 1 | 11
+ 2 | 11 | 2 | 11
+(4 rows)
+
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
select * from p1 order by 1 for update;
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2 for share;
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2 for share of t2;
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val = t2.val) for share;
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 left join t2 on (t1.val = t2.val) for share;
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 right join t2 on (t1.val = t2.val) for share;
+select * from t1 join t2 on (t1.val = t2.val) for share;
+select * from t1 left join t2 on (t1.val = t2.val) for share;
+select * from t1 right join t2 on (t1.val = t2.val) for share;
+
-- three table case
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2, t3;
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2, t3 for update;
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2, t3 for update of t1,t3 nowait;
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1, t2, t3 for share of t1,t2 nowait;
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2);
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update;
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1;
+explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1,t3;
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2);
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update;
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1;
+select * from t1 join t2 on (t1.val2 = t2.val2) join t3 on (t1.val2 = t3.val2) for update of t1,t3;
+
-- check a few subquery cases
explain (costs off, num_nodes off, nodes off, verbose on) select * from (select * from t1 for update of t1 nowait) as foo;
explain (costs off, num_nodes off, nodes off, verbose on) select * from t1 where val in (select val from t2 for update of t2 nowait) for update;