Skip to content

Commit

Permalink
Improve portability of tests with compute_query_id
Browse files Browse the repository at this point in the history
Running installcheck on a cluster with compute_query_id disabled would
cause the tests to fail because it is not possible to retrieve the query
ID on the first call of get_query_id().  compute_query_id is forcibly
set when enabling the hint table, which is something this test relies
on, so let's just set pg_hint_plan.enable_hint_table in this case.

Per offline report from the author.

Author: Yogesh Sharma
Backpatch-through: 17
  • Loading branch information
michaelpq committed Aug 6, 2024
1 parent e34c09a commit 54082fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions expected/ut-T.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SET client_min_messages TO LOG;
SET search_path TO public;
-- This hint affects queries with an equivalent query ID when executed as
-- a subquery.
SET pg_hint_plan.enable_hint_table TO on;
SELECT get_query_id('SELECT * FROM t1 WHERE id = 1;') AS query_id \gset
INSERT INTO hint_plan.hints VALUES (DEFAULT, :'query_id', '', 'SeqScan(t1)');
PREPARE p1 AS SELECT * FROM t1 WHERE id = 100;
Expand Down
1 change: 1 addition & 0 deletions sql/ut-T.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SET search_path TO public;

-- This hint affects queries with an equivalent query ID when executed as
-- a subquery.
SET pg_hint_plan.enable_hint_table TO on;
SELECT get_query_id('SELECT * FROM t1 WHERE id = 1;') AS query_id \gset
INSERT INTO hint_plan.hints VALUES (DEFAULT, :'query_id', '', 'SeqScan(t1)');

Expand Down

0 comments on commit 54082fe

Please sign in to comment.