Skip to content

Commit 12312b7

Browse files
committed
resolve conflicts
2 parents c29c5f0 + 79a1b89 commit 12312b7

File tree

5 files changed

+248
-32
lines changed

5 files changed

+248
-32
lines changed

expected/pathman_rebuild_updates.out

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SELECT append_range_partition('test_updates.test');
2424
(1 row)
2525

2626
INSERT INTO test_updates.test_11 (val, b) VALUES (101, 10);
27+
VACUUM ANALYZE;
2728
/* tuple descs are the same */
2829
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET b = 0 WHERE val = 1;
2930
QUERY PLAN
@@ -43,21 +44,65 @@ UPDATE test_updates.test SET b = 0 WHERE val = 1 RETURNING *, tableoid::REGCLASS
4344
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET b = 0 WHERE val = 101;
4445
QUERY PLAN
4546
-----------------------------
46-
Update on test
47-
Update on test
48-
Update on test_11
49-
-> Seq Scan on test
50-
Filter: (val = 101)
47+
Update on test_11
5148
-> Seq Scan on test_11
5249
Filter: (val = 101)
53-
(7 rows)
50+
(3 rows)
5451

5552
UPDATE test_updates.test SET b = 0 WHERE val = 101 RETURNING *, tableoid::REGCLASS;
5653
val | b | tableoid
5754
-----+---+----------------------
5855
101 | 0 | test_updates.test_11
5956
(1 row)
6057

58+
CREATE TABLE test_updates.test_dummy (val INT4);
59+
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET val = val + 1
60+
WHERE val = 101 AND val = ANY (TABLE test_updates.test_dummy)
61+
RETURNING *, tableoid::REGCLASS;
62+
QUERY PLAN
63+
------------------------------------
64+
Update on test_11
65+
-> Nested Loop Semi Join
66+
-> Seq Scan on test_11
67+
Filter: (val = 101)
68+
-> Seq Scan on test_dummy
69+
Filter: (val = 101)
70+
(6 rows)
71+
72+
EXPLAIN (COSTS OFF) UPDATE test_updates.test t1 SET b = 0
73+
FROM test_updates.test_dummy t2
74+
WHERE t1.val = 101 AND t1.val = t2.val
75+
RETURNING t1.*, t1.tableoid::REGCLASS;
76+
QUERY PLAN
77+
---------------------------------------
78+
Update on test_11 t1
79+
-> Nested Loop
80+
-> Seq Scan on test_11 t1
81+
Filter: (val = 101)
82+
-> Seq Scan on test_dummy t2
83+
Filter: (val = 101)
84+
(6 rows)
85+
86+
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET b = 0
87+
WHERE val = 101 AND test >= (100, 8)
88+
RETURNING *, tableoid::REGCLASS;
89+
QUERY PLAN
90+
-----------------------------------------------------------------------------------
91+
Update on test_11
92+
-> Seq Scan on test_11
93+
Filter: (((test_11.*)::test_updates.test >= ROW(100, 8)) AND (val = 101))
94+
(3 rows)
95+
96+
/* execute this one */
97+
UPDATE test_updates.test SET b = 0
98+
WHERE val = 101 AND test >= (100, -1)
99+
RETURNING test;
100+
test
101+
---------
102+
(101,0)
103+
(1 row)
104+
105+
DROP TABLE test_updates.test_dummy;
61106
DROP SCHEMA test_updates CASCADE;
62107
NOTICE: drop cascades to 13 other objects
63108
DROP EXTENSION pg_pathman;

sql/pathman_rebuild_updates.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ SELECT append_range_partition('test_updates.test');
2222
INSERT INTO test_updates.test_11 (val, b) VALUES (101, 10);
2323

2424

25+
VACUUM ANALYZE;
26+
27+
2528
/* tuple descs are the same */
2629
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET b = 0 WHERE val = 1;
2730
UPDATE test_updates.test SET b = 0 WHERE val = 1 RETURNING *, tableoid::REGCLASS;
@@ -31,6 +34,28 @@ UPDATE test_updates.test SET b = 0 WHERE val = 1 RETURNING *, tableoid::REGCLASS
3134
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET b = 0 WHERE val = 101;
3235
UPDATE test_updates.test SET b = 0 WHERE val = 101 RETURNING *, tableoid::REGCLASS;
3336

37+
CREATE TABLE test_updates.test_dummy (val INT4);
38+
39+
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET val = val + 1
40+
WHERE val = 101 AND val = ANY (TABLE test_updates.test_dummy)
41+
RETURNING *, tableoid::REGCLASS;
42+
43+
EXPLAIN (COSTS OFF) UPDATE test_updates.test t1 SET b = 0
44+
FROM test_updates.test_dummy t2
45+
WHERE t1.val = 101 AND t1.val = t2.val
46+
RETURNING t1.*, t1.tableoid::REGCLASS;
47+
48+
EXPLAIN (COSTS OFF) UPDATE test_updates.test SET b = 0
49+
WHERE val = 101 AND test >= (100, 8)
50+
RETURNING *, tableoid::REGCLASS;
51+
52+
/* execute this one */
53+
UPDATE test_updates.test SET b = 0
54+
WHERE val = 101 AND test >= (100, -1)
55+
RETURNING test;
56+
57+
DROP TABLE test_updates.test_dummy;
58+
3459

3560

3661
DROP SCHEMA test_updates CASCADE;

src/include/compat/pg_compat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "optimizer/cost.h"
3232
#include "optimizer/paths.h"
3333
#include "optimizer/pathnode.h"
34+
#include "optimizer/prep.h"
3435
#include "utils/memutils.h"
3536

3637
/*

src/pg_pathman.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "miscadmin.h"
2929
#include "optimizer/clauses.h"
3030
#include "optimizer/plancat.h"
31-
#include "optimizer/prep.h"
3231
#include "optimizer/restrictinfo.h"
3332
#include "optimizer/cost.h"
3433
#include "utils/datum.h"

0 commit comments

Comments
 (0)