diff --git a/src/gausskernel/optimizer/commands/variable.cpp b/src/gausskernel/optimizer/commands/variable.cpp index bd1cb4a99..faf35fb4b 100644 --- a/src/gausskernel/optimizer/commands/variable.cpp +++ b/src/gausskernel/optimizer/commands/variable.cpp @@ -874,7 +874,7 @@ bool check_collation_connection(char** newval, void** extra, GucSource source) } Oid collid = get_collation_oid_with_lower_name(*newval, PG_INVALID_ENCODING); - if (!OidIsValid(collid)) { + if (!COLLATION_IN_B_FORMAT(collid)) { return false; } diff --git a/src/test/regress/output/charset_connection_test.source b/src/test/regress/output/charset_connection_test.source index 6478f6da4..583ea3664 100644 --- a/src/test/regress/output/charset_connection_test.source +++ b/src/test/regress/output/charset_connection_test.source @@ -293,16 +293,17 @@ show collation_connection; set names gbk; set names utf8 collate 'default'; +ERROR: invalid value for parameter "collation_connection": "default" show character_set_connection; character_set_connection -------------------------- - UTF8 + GBK (1 row) show collation_connection; collation_connection ---------------------- - default + gbk_chinese_ci (1 row) set names gbk; @@ -321,6 +322,7 @@ show collation_connection; -- test charset = -1 set collation_connection = 'C'; +ERROR: invalid value for parameter "collation_connection": "C" show character_set_connection; character_set_connection -------------------------- @@ -330,10 +332,11 @@ show character_set_connection; show collation_connection; collation_connection ---------------------- - C + utf8mb4_general_ci (1 row) set collation_connection = 'default'; +ERROR: invalid value for parameter "collation_connection": "default" show character_set_connection; character_set_connection -------------------------- @@ -343,10 +346,11 @@ show character_set_connection; show collation_connection; collation_connection ---------------------- - default + utf8mb4_general_ci (1 row) set collation_connection = 'POSIX'; +ERROR: invalid value for parameter "collation_connection": "POSIX" show character_set_connection; character_set_connection -------------------------- @@ -356,7 +360,7 @@ show character_set_connection; show collation_connection; collation_connection ---------------------- - POSIX + utf8mb4_general_ci (1 row) \! @abs_bindir@/gs_guc reload -Z datanode -D @abs_srcdir@/tmp_check/datanode1 -c "b_format_behavior_compat_options=''" >/dev/null 2>&1