!4022 修复collation_connection可以设置系统字符集的问题
Merge pull request !4022 from 魏文韬/charset_fix
This commit is contained in:
@ -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);
|
Oid collid = get_collation_oid_with_lower_name(*newval, PG_INVALID_ENCODING);
|
||||||
if (!OidIsValid(collid)) {
|
if (!COLLATION_IN_B_FORMAT(collid)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,16 +293,17 @@ show collation_connection;
|
|||||||
|
|
||||||
set names gbk;
|
set names gbk;
|
||||||
set names utf8 collate 'default';
|
set names utf8 collate 'default';
|
||||||
|
ERROR: invalid value for parameter "collation_connection": "default"
|
||||||
show character_set_connection;
|
show character_set_connection;
|
||||||
character_set_connection
|
character_set_connection
|
||||||
--------------------------
|
--------------------------
|
||||||
UTF8
|
GBK
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
show collation_connection;
|
show collation_connection;
|
||||||
collation_connection
|
collation_connection
|
||||||
----------------------
|
----------------------
|
||||||
default
|
gbk_chinese_ci
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
set names gbk;
|
set names gbk;
|
||||||
@ -321,6 +322,7 @@ show collation_connection;
|
|||||||
|
|
||||||
-- test charset = -1
|
-- test charset = -1
|
||||||
set collation_connection = 'C';
|
set collation_connection = 'C';
|
||||||
|
ERROR: invalid value for parameter "collation_connection": "C"
|
||||||
show character_set_connection;
|
show character_set_connection;
|
||||||
character_set_connection
|
character_set_connection
|
||||||
--------------------------
|
--------------------------
|
||||||
@ -330,10 +332,11 @@ show character_set_connection;
|
|||||||
show collation_connection;
|
show collation_connection;
|
||||||
collation_connection
|
collation_connection
|
||||||
----------------------
|
----------------------
|
||||||
C
|
utf8mb4_general_ci
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
set collation_connection = 'default';
|
set collation_connection = 'default';
|
||||||
|
ERROR: invalid value for parameter "collation_connection": "default"
|
||||||
show character_set_connection;
|
show character_set_connection;
|
||||||
character_set_connection
|
character_set_connection
|
||||||
--------------------------
|
--------------------------
|
||||||
@ -343,10 +346,11 @@ show character_set_connection;
|
|||||||
show collation_connection;
|
show collation_connection;
|
||||||
collation_connection
|
collation_connection
|
||||||
----------------------
|
----------------------
|
||||||
default
|
utf8mb4_general_ci
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
set collation_connection = 'POSIX';
|
set collation_connection = 'POSIX';
|
||||||
|
ERROR: invalid value for parameter "collation_connection": "POSIX"
|
||||||
show character_set_connection;
|
show character_set_connection;
|
||||||
character_set_connection
|
character_set_connection
|
||||||
--------------------------
|
--------------------------
|
||||||
@ -356,7 +360,7 @@ show character_set_connection;
|
|||||||
show collation_connection;
|
show collation_connection;
|
||||||
collation_connection
|
collation_connection
|
||||||
----------------------
|
----------------------
|
||||||
POSIX
|
utf8mb4_general_ci
|
||||||
(1 row)
|
(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
|
\! @abs_bindir@/gs_guc reload -Z datanode -D @abs_srcdir@/tmp_check/datanode1 -c "b_format_behavior_compat_options=''" >/dev/null 2>&1
|
||||||
|
Reference in New Issue
Block a user