From 66ba07f0d73ec774f4077f467430a5c66842e521 Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Wed, 21 Aug 2024 11:27:52 -0500 Subject: [PATCH] add index_advisor tests --- nix/tests/expected/index_advisor.out | 16 ++++++++++++++++ nix/tests/sql/index_advisor.sql | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 nix/tests/expected/index_advisor.out create mode 100644 nix/tests/sql/index_advisor.sql diff --git a/nix/tests/expected/index_advisor.out b/nix/tests/expected/index_advisor.out new file mode 100644 index 000000000..5a269ba54 --- /dev/null +++ b/nix/tests/expected/index_advisor.out @@ -0,0 +1,16 @@ +create schema v; +create table v.book( + id int primary key, + title text not null +); +select + index_statements, errors +from + index_advisor('select id from v.book where title = $1'); + index_statements | errors +------------------------------------------------+-------- + {"CREATE INDEX ON v.book USING btree (title)"} | {} +(1 row) + +drop schema v cascade; +NOTICE: drop cascades to table v.book diff --git a/nix/tests/sql/index_advisor.sql b/nix/tests/sql/index_advisor.sql new file mode 100644 index 000000000..3911d6eb5 --- /dev/null +++ b/nix/tests/sql/index_advisor.sql @@ -0,0 +1,13 @@ +create schema v; + +create table v.book( + id int primary key, + title text not null +); + +select + index_statements, errors +from + index_advisor('select id from v.book where title = $1'); + +drop schema v cascade;