未验证 提交 9a6cd1ee 编写于 作者: X xiong-gang 提交者: GitHub

Don't dispatch client_encoding to QE

When client_encoding is dispatch to QE, error messages generated in QEs were
converted to client_encoding, but QD assumed that they were in server encoding,
it will leads to corruption.

This is fixed in 6X in a6c9b4, but this skips the gpcopy changes since 5X
doesn't support syntax 'COPY...ENCODING'.

Fix issue: https://github.com/greenplum-db/gpdb/issues/10815
上级 8083a046
...@@ -5573,6 +5573,13 @@ DispatchSetPGVariable(const char *name, List *args, bool is_local) ...@@ -5573,6 +5573,13 @@ DispatchSetPGVariable(const char *name, List *args, bool is_local)
if (Gp_role != GP_ROLE_DISPATCH || IsBootstrapProcessingMode()) if (Gp_role != GP_ROLE_DISPATCH || IsBootstrapProcessingMode())
return; return;
/*
* client_encoding is always kept at SQL_ASCII in QE processes. (See also
* cdbconn_doConnectStart().)
*/
if (strcmp(name, "client_encoding") == 0)
return;
initStringInfo( &buffer ); initStringInfo( &buffer );
if (args == NIL) if (args == NIL)
......
-- Don't dispatch 'client_encoding'
-- When client_encoding is dispatch to QE, error messages generated in QEs were
-- converted to client_encoding, but QD assumed that they were in server encoding,
-- it will leads to corruption.
set client_encoding = 'latin1';
create function raise_error(t text) returns void as $$
begin
raise exception 'raise_error called on "%"', t;
end;
$$ language plpgsql;
select raise_error('funny char ' || chr(196)) from gp_dist_random('gp_id');
ERROR: raise_error called on "funny char Ä" (seg0 slice1 172.17.0.2:25432 pid=227665)
...@@ -19,7 +19,7 @@ test: gp_metadata variadic_parameters default_parameters function_extensions spi ...@@ -19,7 +19,7 @@ test: gp_metadata variadic_parameters default_parameters function_extensions spi
test: leastsquares opr_sanity_gp decode_expr bitmapscan bitmapscan_ao case_gp limit_gp notin percentile join_gp union_gp gpcopy gp_create_table gp_create_view resource_queue_with_rule test: leastsquares opr_sanity_gp decode_expr bitmapscan bitmapscan_ao case_gp limit_gp notin percentile join_gp union_gp gpcopy gp_create_table gp_create_view resource_queue_with_rule
test: filter gpctas gpdist matrix toast sublink table_functions olap_setup complex opclass_ddl information_schema guc_env_var guc_gp gp_explain distributed_transactions test: filter gpctas gpdist matrix toast sublink table_functions olap_setup complex opclass_ddl information_schema guc_env_var guc_gp gp_explain distributed_transactions
test: bitmap_index gp_dump_query_oids analyze gp_owner_permission incremental_analyze gang_reuse test: bitmap_index gp_dump_query_oids analyze gp_owner_permission incremental_analyze gang_reuse dispatch_encoding
test: indexjoin as_alias regex_gp gpparams with_clause transient_types gp_rules motion_gp test: indexjoin as_alias regex_gp gpparams with_clause transient_types gp_rules motion_gp
# dispatch should always run seperately from other cases. # dispatch should always run seperately from other cases.
test: dispatch test: dispatch
......
-- Don't dispatch 'client_encoding'
-- When client_encoding is dispatch to QE, error messages generated in QEs were
-- converted to client_encoding, but QD assumed that they were in server encoding,
-- it will leads to corruption.
set client_encoding = 'latin1';
create function raise_error(t text) returns void as $$
begin
raise exception 'raise_error called on "%"', t;
end;
$$ language plpgsql;
select raise_error('funny char ' || chr(196)) from gp_dist_random('gp_id');
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册