Skip to content

Commit c1d59bd

Browse files
committed
fix problems with DELETE USING mentioned in issue #111
1 parent 200a391 commit c1d59bd

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

expected/pathman_basic.out

+14
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,20 @@ EXPLAIN (COSTS OFF) DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '
17401740
(7 rows)
17411741

17421742
DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '2010-01-02' AND r.id = t.id;
1743+
EXPLAIN (COSTS OFF) DELETE FROM test.tmp t USING test.range_rel r WHERE r.dt = '2010-01-02' AND r.id = t.id;
1744+
QUERY PLAN
1745+
--------------------------------------------------------------------------------------------------
1746+
Delete on tmp t
1747+
-> Hash Join
1748+
Hash Cond: (t.id = r.id)
1749+
-> Seq Scan on tmp t
1750+
-> Hash
1751+
-> Append
1752+
-> Index Scan using range_rel_1_pkey on range_rel_1 r
1753+
Filter: (dt = 'Sat Jan 02 00:00:00 2010'::timestamp without time zone)
1754+
(8 rows)
1755+
1756+
DELETE FROM test.tmp t USING test.range_rel r WHERE r.dt = '2010-01-02' AND r.id = t.id;
17431757
/* Create range partitions from whole range */
17441758
SELECT drop_partitions('test.range_rel');
17451759
NOTICE: 44 rows copied from test.range_rel_1

sql/pathman_basic.sql

+3
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,9 @@ UPDATE test.range_rel r SET value = t.value FROM test.tmp t WHERE r.dt = '2010-0
527527
EXPLAIN (COSTS OFF) DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '2010-01-02' AND r.id = t.id;
528528
DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '2010-01-02' AND r.id = t.id;
529529

530+
EXPLAIN (COSTS OFF) DELETE FROM test.tmp t USING test.range_rel r WHERE r.dt = '2010-01-02' AND r.id = t.id;
531+
DELETE FROM test.tmp t USING test.range_rel r WHERE r.dt = '2010-01-02' AND r.id = t.id;
532+
530533

531534
/* Create range partitions from whole range */
532535
SELECT drop_partitions('test.range_rel');

src/planner_tree_modification.c

-9
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,6 @@ disable_standard_inheritance(Query *parse)
188188
ListCell *lc;
189189
Index current_rti; /* current range table entry index */
190190

191-
/*
192-
* We can't handle non-SELECT queries unless
193-
* there's a pathman_expand_inherited_rtentry_hook()
194-
*/
195-
#ifndef NATIVE_EXPAND_RTE_HOOK
196-
if (parse->commandType != CMD_SELECT)
197-
return;
198-
#endif
199-
200191
/* Walk through RangeTblEntries list */
201192
current_rti = 0;
202193
foreach (lc, parse->rtable)

0 commit comments

Comments
 (0)