From a0424e15ad151608217295c446d0683928c57b84 Mon Sep 17 00:00:00 2001 From: Karthik Ramanathan Date: Thu, 9 Jan 2025 12:20:23 -0800 Subject: [PATCH] [#25042] YSQL: Fix yb_lock_status test for ASAN/TSAN Summary: `yb_lock_status` in `testPgRegressProc` has been failing in ASAN and TSAN consistently. The cause of failure is a change in output between PG 11 and PG 15 for queries of the form: `SELECT FROM ;` In PG 11, this produced an output in the following format: ``` yugabyte=# SELECT true FROM test; bool ------ (0 rows) ``` while in PG 15, the output was as follows: ``` yugabyte=# SELECT true FROM test; ?column? ---------- (0 rows) ``` In other words, in PG 15, the name of the column is no longer set to be the data type of the constant, if the data type is not explicitly specified. D31424 fixed the output in the PG 15 branch for the output files: `yb_lock_status.out` and `yb_lock_status_1.out` Later, D32492 introduced a new output file with the PG 11 style output: `yb_lock_status_2.out` The files correspond to the following build types/configurations: - yb_lock_status_2.out: ASAN, TSAN - yb_lock_status_1.out: All other build types - yb_lock_status.out: All build types when READ COMMITTED isolation level is not enabled. This revision modifies the queries to explicitly specify the data type for queries of the form `SELECT FROM ;` This will also prevent the test from failing again if the name of the column in the output changes again in the future. Note that `testPgRegressProc` will continue to fail on Mac due to a different regress test (yb_get_current_transaction_priority). Jira: DB-14176 Test Plan: Run the following test: ``` ./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressProc#testPgRegressProc' ``` Reviewers: patnaik.balivada Reviewed By: patnaik.balivada Subscribers: yql Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D41136 --- .../test/regress/expected/yb_lock_status.out | 36 +++++++++---------- .../regress/expected/yb_lock_status_1.out | 36 +++++++++---------- .../regress/expected/yb_lock_status_2.out | 16 ++++----- .../src/test/regress/sql/yb_lock_status.sql | 12 +++---- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/postgres/src/test/regress/expected/yb_lock_status.out b/src/postgres/src/test/regress/expected/yb_lock_status.out index 1fe94114f0ce..cf10bf0754d9 100644 --- a/src/postgres/src/test/regress/expected/yb_lock_status.out +++ b/src/postgres/src/test/regress/expected/yb_lock_status.out @@ -112,33 +112,33 @@ BEGIN END ; $$ LANGUAGE plpgsql; -- Basic queries -SELECT true FROM yb_lock_status(null, null); - ?column? ----------- +SELECT true::bool FROM yb_lock_status(null, null); + bool +------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null); - ?column? ----------- +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null); + bool +------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); - ?column? ----------- +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); + bool +------ (0 rows) -SELECT true FROM yb_lock_status(null, 'bogus'); +SELECT true::bool FROM yb_lock_status(null, 'bogus'); ERROR: invalid input syntax for type uuid: "bogus" -LINE 1: SELECT true FROM yb_lock_status(null, 'bogus'); - ^ -SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); - ?column? ----------- +LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus'); + ^ +SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); + bool +------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); - ?column? ----------- +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); + bool +------ (0 rows) -- READ COMMITTED diff --git a/src/postgres/src/test/regress/expected/yb_lock_status_1.out b/src/postgres/src/test/regress/expected/yb_lock_status_1.out index 7a5665e32b3c..886145fa825c 100644 --- a/src/postgres/src/test/regress/expected/yb_lock_status_1.out +++ b/src/postgres/src/test/regress/expected/yb_lock_status_1.out @@ -112,33 +112,33 @@ BEGIN END ; $$ LANGUAGE plpgsql; -- Basic queries -SELECT true FROM yb_lock_status(null, null); - ?column? ----------- +SELECT true::bool FROM yb_lock_status(null, null); + bool +------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null); - ?column? ----------- +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null); + bool +------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); - ?column? ----------- +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); + bool +------ (0 rows) -SELECT true FROM yb_lock_status(null, 'bogus'); +SELECT true::bool FROM yb_lock_status(null, 'bogus'); ERROR: invalid input syntax for type uuid: "bogus" -LINE 1: SELECT true FROM yb_lock_status(null, 'bogus'); - ^ -SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); - ?column? ----------- +LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus'); + ^ +SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); + bool +------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); - ?column? ----------- +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); + bool +------ (0 rows) -- READ COMMITTED diff --git a/src/postgres/src/test/regress/expected/yb_lock_status_2.out b/src/postgres/src/test/regress/expected/yb_lock_status_2.out index 4f2e164afdb2..6372cdfc5b37 100644 --- a/src/postgres/src/test/regress/expected/yb_lock_status_2.out +++ b/src/postgres/src/test/regress/expected/yb_lock_status_2.out @@ -112,31 +112,31 @@ BEGIN END ; $$ LANGUAGE plpgsql; -- Basic queries -SELECT true FROM yb_lock_status(null, null); +SELECT true::bool FROM yb_lock_status(null, null); bool ------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null); +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null); bool ------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); bool ------ (0 rows) -SELECT true FROM yb_lock_status(null, 'bogus'); +SELECT true::bool FROM yb_lock_status(null, 'bogus'); ERROR: invalid input syntax for type uuid: "bogus" -LINE 1: SELECT true FROM yb_lock_status(null, 'bogus'); - ^ -SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); +LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus'); + ^ +SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); bool ------ (0 rows) -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); bool ------ (0 rows) diff --git a/src/postgres/src/test/regress/sql/yb_lock_status.sql b/src/postgres/src/test/regress/sql/yb_lock_status.sql index b0e58d6f8630..a8decb364ac1 100644 --- a/src/postgres/src/test/regress/sql/yb_lock_status.sql +++ b/src/postgres/src/test/regress/sql/yb_lock_status.sql @@ -117,12 +117,12 @@ END ; $$ LANGUAGE plpgsql; -- Basic queries -SELECT true FROM yb_lock_status(null, null); -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null); -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); -SELECT true FROM yb_lock_status(null, 'bogus'); -SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); -SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); +SELECT true::bool FROM yb_lock_status(null, null); +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null); +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null); +SELECT true::bool FROM yb_lock_status(null, 'bogus'); +SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000'); +SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000'); -- READ COMMITTED -- Basic insert