From 54082fef70c81941790864cbd38633fedaefd7fd Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 6 Aug 2024 10:10:35 +0900 Subject: [PATCH] Improve portability of tests with compute_query_id 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 --- expected/ut-T.out | 1 + sql/ut-T.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/expected/ut-T.out b/expected/ut-T.out index 303adf6..08cf2cd 100644 --- a/expected/ut-T.out +++ b/expected/ut-T.out @@ -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; diff --git a/sql/ut-T.sql b/sql/ut-T.sql index 3d14b7e..a10de85 100644 --- a/sql/ut-T.sql +++ b/sql/ut-T.sql @@ -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)');