Skip to content

Commit a0424e1

Browse files
[yugabyte#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 <constant> FROM <relation>;` 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 <constant> FROM <relation>;` 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
1 parent ff7dbba commit a0424e1

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

src/postgres/src/test/regress/expected/yb_lock_status.out

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,33 +112,33 @@ BEGIN
112112
END ;
113113
$$ LANGUAGE plpgsql;
114114
-- Basic queries
115-
SELECT true FROM yb_lock_status(null, null);
116-
?column?
117-
----------
115+
SELECT true::bool FROM yb_lock_status(null, null);
116+
bool
117+
------
118118
(0 rows)
119119

120-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
121-
?column?
122-
----------
120+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
121+
bool
122+
------
123123
(0 rows)
124124

125-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
126-
?column?
127-
----------
125+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
126+
bool
127+
------
128128
(0 rows)
129129

130-
SELECT true FROM yb_lock_status(null, 'bogus');
130+
SELECT true::bool FROM yb_lock_status(null, 'bogus');
131131
ERROR: invalid input syntax for type uuid: "bogus"
132-
LINE 1: SELECT true FROM yb_lock_status(null, 'bogus');
133-
^
134-
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
135-
?column?
136-
----------
132+
LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus');
133+
^
134+
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
135+
bool
136+
------
137137
(0 rows)
138138

139-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
140-
?column?
141-
----------
139+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
140+
bool
141+
------
142142
(0 rows)
143143

144144
-- READ COMMITTED

src/postgres/src/test/regress/expected/yb_lock_status_1.out

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,33 +112,33 @@ BEGIN
112112
END ;
113113
$$ LANGUAGE plpgsql;
114114
-- Basic queries
115-
SELECT true FROM yb_lock_status(null, null);
116-
?column?
117-
----------
115+
SELECT true::bool FROM yb_lock_status(null, null);
116+
bool
117+
------
118118
(0 rows)
119119

120-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
121-
?column?
122-
----------
120+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
121+
bool
122+
------
123123
(0 rows)
124124

125-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
126-
?column?
127-
----------
125+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
126+
bool
127+
------
128128
(0 rows)
129129

130-
SELECT true FROM yb_lock_status(null, 'bogus');
130+
SELECT true::bool FROM yb_lock_status(null, 'bogus');
131131
ERROR: invalid input syntax for type uuid: "bogus"
132-
LINE 1: SELECT true FROM yb_lock_status(null, 'bogus');
133-
^
134-
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
135-
?column?
136-
----------
132+
LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus');
133+
^
134+
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
135+
bool
136+
------
137137
(0 rows)
138138

139-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
140-
?column?
141-
----------
139+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
140+
bool
141+
------
142142
(0 rows)
143143

144144
-- READ COMMITTED

src/postgres/src/test/regress/expected/yb_lock_status_2.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,31 +112,31 @@ BEGIN
112112
END ;
113113
$$ LANGUAGE plpgsql;
114114
-- Basic queries
115-
SELECT true FROM yb_lock_status(null, null);
115+
SELECT true::bool FROM yb_lock_status(null, null);
116116
bool
117117
------
118118
(0 rows)
119119

120-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
120+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
121121
bool
122122
------
123123
(0 rows)
124124

125-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
125+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
126126
bool
127127
------
128128
(0 rows)
129129

130-
SELECT true FROM yb_lock_status(null, 'bogus');
130+
SELECT true::bool FROM yb_lock_status(null, 'bogus');
131131
ERROR: invalid input syntax for type uuid: "bogus"
132-
LINE 1: SELECT true FROM yb_lock_status(null, 'bogus');
133-
^
134-
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
132+
LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus');
133+
^
134+
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
135135
bool
136136
------
137137
(0 rows)
138138

139-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
139+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
140140
bool
141141
------
142142
(0 rows)

src/postgres/src/test/regress/sql/yb_lock_status.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ END ;
117117
$$ LANGUAGE plpgsql;
118118

119119
-- Basic queries
120-
SELECT true FROM yb_lock_status(null, null);
121-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
122-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
123-
SELECT true FROM yb_lock_status(null, 'bogus');
124-
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
125-
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
120+
SELECT true::bool FROM yb_lock_status(null, null);
121+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
122+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
123+
SELECT true::bool FROM yb_lock_status(null, 'bogus');
124+
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
125+
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
126126

127127
-- READ COMMITTED
128128
-- Basic insert

0 commit comments

Comments
 (0)