repro-dml-returning.sql
application/sql
Filename: repro-dml-returning.sql
Type: application/sql
Part: 0
DROP VIEW IF EXISTS part_abc_view; DROP TABLE IF EXISTS part_abc; set plan_cache_mode = force_generic_plan; create table part_abc (a int, b text, c bool) partition by list (a); create table part_abc_1 (b text, a int, c bool); create table part_abc_2 (a int, c bool, b text); alter table part_abc attach partition part_abc_1 for values in (1); alter table part_abc attach partition part_abc_2 for values in (2); insert into part_abc values (1, 'b', true); insert into part_abc values (2, 'c', true); create view part_abc_view as select * from part_abc where b <> 'a' with check option; prepare update_part_abc_view as update part_abc_view set b = $2 where a = $1 returning *; -- Only the unpruned partition should be shown in the list of relations to be -- updated explain (costs off, verbose) execute update_part_abc_view (1, 'd'); execute update_part_abc_view (1, 'd'); explain (costs off, verbose) execute update_part_abc_view (2, 'a'); execute update_part_abc_view (2, 'a'); -- All pruned. explain (costs off, verbose) execute update_part_abc_view (3, 'a'); execute update_part_abc_view (3, 'a'); deallocate update_part_abc_view;