Skip to content

Commit 189b8b5

Browse files
oliricedarora
authored andcommitted
add pg_plan_filter tests
1 parent e46f391 commit 189b8b5

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

nix/tests/expected/pg_plan_filter.out

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
begin;
2+
load 'plan_filter';
3+
create schema v;
4+
-- create a sample table
5+
create table v.test_table (
6+
id serial primary key,
7+
data text
8+
);
9+
-- insert some test data
10+
insert into v.test_table (data)
11+
values ('sample1'), ('sample2'), ('sample3');
12+
set local plan_filter.statement_cost_limit = 0.001;
13+
select * from v.test_table;
14+
ERROR: plan cost limit exceeded
15+
HINT: The plan for your query shows that it would probably have an excessive run time. This may be due to a logic error in the SQL, or it maybe just a very costly query. Rewrite your query or increase the configuration parameter "plan_filter.statement_cost_limit".
16+
rollback;

nix/tests/sql/pg_plan_filter.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
begin;
2+
load 'plan_filter';
3+
4+
create schema v;
5+
6+
-- create a sample table
7+
create table v.test_table (
8+
id serial primary key,
9+
data text
10+
);
11+
12+
-- insert some test data
13+
insert into v.test_table (data)
14+
values ('sample1'), ('sample2'), ('sample3');
15+
16+
set local plan_filter.statement_cost_limit = 0.001;
17+
18+
select * from v.test_table;
19+
20+
rollback;
21+
22+

0 commit comments

Comments
 (0)