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)
This commit is contained in:
Julien Rouhaud 2021-02-28 17:02:49 +08:00
parent 7e072c1f94
commit 8eb71b0dda
2 changed files with 14 additions and 10 deletions

View file

@ -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

View file

@ -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