From 8eb71b0dda1ec4b8c42f7a15348ab7fcf8529f8a Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Sun, 28 Feb 2021 17:02:49 +0800 Subject: [PATCH] Make new regression tests for INCLUDE stable. The regression tests included the oid of the hypothetical index. Since the hypothetical Oid generator was introduced, the sequence of generated Oids is somewhat stable for a given PostgreSQL major version, but is defenitely not across multiple major versions. (cherry picked from commit 203a0200464e7bbe55bc386eca6cb0c938bb48c1) --- expected/hypo_include.out | 18 ++++++++++-------- test/sql/hypo_include.sql | 6 ++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/expected/hypo_include.out b/expected/hypo_include.out index 3febb3a..fff33b4 100644 --- a/expected/hypo_include.out +++ b/expected/hypo_include.out @@ -10,10 +10,11 @@ SELECT hypopg_reset(); VACUUM ANALYZE hypo; -- Should not use hypothetical index -- Create normal index -SELECT hypopg_create_index('CREATE INDEX ON hypo (id)'); - hypopg_create_index ------------------------------- - (13719,<13719>btree_hypo_id) +SELECT COUNT(*) AS NB +FROM hypopg_create_index('CREATE INDEX ON hypo (id)'); + nb +---- + 1 (1 row) -- Should use hypothetical index using a regular Index Scan @@ -32,10 +33,11 @@ SELECT hypopg_reset(); (1 row) -- Create INCLUDE index -SELECT hypopg_create_index('CREATE INDEX ON hypo (id) INCLUDE (val)'); - hypopg_create_index ----------------------------------- - (13719,<13719>btree_hypo_id_val) +SELECT COUNT(*) AS NB +FROM hypopg_create_index('CREATE INDEX ON hypo (id) INCLUDE (val)'); + nb +---- + 1 (1 row) -- Should use hypothetical index using an Index Only Scan diff --git a/test/sql/hypo_include.sql b/test/sql/hypo_include.sql index 9c944b5..4ee483b 100644 --- a/test/sql/hypo_include.sql +++ b/test/sql/hypo_include.sql @@ -9,7 +9,8 @@ VACUUM ANALYZE hypo; -- Should not use hypothetical index -- Create normal index -SELECT hypopg_create_index('CREATE INDEX ON hypo (id)'); +SELECT COUNT(*) AS NB +FROM hypopg_create_index('CREATE INDEX ON hypo (id)'); -- Should use hypothetical index using a regular Index Scan SELECT COUNT(*) FROM do_explain('SELECT val FROM hypo WHERE id = 1') e @@ -19,7 +20,8 @@ WHERE e ~ 'Index Scan.*<\d+>btree_hypo.*'; SELECT hypopg_reset(); -- Create INCLUDE index -SELECT hypopg_create_index('CREATE INDEX ON hypo (id) INCLUDE (val)'); +SELECT COUNT(*) AS NB +FROM hypopg_create_index('CREATE INDEX ON hypo (id) INCLUDE (val)'); -- Should use hypothetical index using an Index Only Scan SELECT COUNT(*) FROM do_explain('SELECT val FROM hypo WHERE id = 1') e