Skip to content

Commit

Permalink
add pg_plan_filter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olirice authored and darora committed Aug 22, 2024
1 parent e46f391 commit 189b8b5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nix/tests/expected/pg_plan_filter.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
begin;
load 'plan_filter';
create schema v;
-- create a sample table
create table v.test_table (
id serial primary key,
data text
);
-- insert some test data
insert into v.test_table (data)
values ('sample1'), ('sample2'), ('sample3');
set local plan_filter.statement_cost_limit = 0.001;
select * from v.test_table;
ERROR: plan cost limit exceeded
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".
rollback;
22 changes: 22 additions & 0 deletions nix/tests/sql/pg_plan_filter.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
begin;
load 'plan_filter';

create schema v;

-- create a sample table
create table v.test_table (
id serial primary key,
data text
);

-- insert some test data
insert into v.test_table (data)
values ('sample1'), ('sample2'), ('sample3');

set local plan_filter.statement_cost_limit = 0.001;

select * from v.test_table;

rollback;


0 comments on commit 189b8b5

Please sign in to comment.