Skip to content

Commit 08f9e6d

Browse files
macdiceRucha Kulkarni
authored andcommitted
Fix test_valid_server_encoding helper function.
Commit c67bef3f325 introduced this test helper function for use by src/test/regress/sql/encoding.sql, but its logic was incorrect. It confused an encoding ID for a boolean so it gave the wrong results for some inputs, and also forgot the usual return macro. The mistake didn't affect values actually used in the test, so there is no change in behavior. Also drop it and another missed function at the end of the test, for consistency. Backpatch-through: 14 Author: Zsolt Parragi <zsolt.parragi@percona.com> (cherry picked from commit c33d67fd18edec3000be0e5d12096d983e0eced5)
1 parent 26a52c3 commit 08f9e6d

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/test/regress/expected/encoding.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ SELECT SUBSTRING(c FROM 3000 FOR 1) FROM toast_4b_utf8;
419419
DROP TABLE encoding_tests;
420420
DROP TABLE toast_4b_utf8;
421421
DROP FUNCTION test_encoding;
422+
DROP FUNCTION test_wchars_to_text;
422423
DROP FUNCTION test_text_to_wchars;
424+
DROP FUNCTION test_valid_server_encoding;
423425
DROP FUNCTION test_mblen_func;
424426
DROP FUNCTION test_bytea_to_text;
425427
DROP FUNCTION test_text_to_bytea;

src/test/regress/regress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ PG_FUNCTION_INFO_V1(test_valid_server_encoding);
14231423
Datum
14241424
test_valid_server_encoding(PG_FUNCTION_ARGS)
14251425
{
1426-
return pg_valid_server_encoding(text_to_cstring(PG_GETARG_TEXT_PP(0)));
1426+
PG_RETURN_BOOL(pg_valid_server_encoding(text_to_cstring(PG_GETARG_TEXT_PP(0))) >= 0);
14271427
}
14281428

14291429
/* Provide SQL access to IsBinaryCoercible() */

src/test/regress/sql/encoding.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ SELECT SUBSTRING(c FROM 3000 FOR 1) FROM toast_4b_utf8;
231231
DROP TABLE encoding_tests;
232232
DROP TABLE toast_4b_utf8;
233233
DROP FUNCTION test_encoding;
234+
DROP FUNCTION test_wchars_to_text;
234235
DROP FUNCTION test_text_to_wchars;
236+
DROP FUNCTION test_valid_server_encoding;
235237
DROP FUNCTION test_mblen_func;
236238
DROP FUNCTION test_bytea_to_text;
237239
DROP FUNCTION test_text_to_bytea;

0 commit comments

Comments
 (0)