From a87c53b7ae60a5259a7b25d9cf9563a7184b1fd8 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Fri, 12 Sep 2008 08:32:59 +0000 Subject: [PATCH] allow win32 specific encoding corruption (8.2.9) --- expected/plproxy_encoding_1.out | 223 ++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 expected/plproxy_encoding_1.out diff --git a/expected/plproxy_encoding_1.out b/expected/plproxy_encoding_1.out new file mode 100644 index 0000000..ff5a33c --- /dev/null +++ b/expected/plproxy_encoding_1.out @@ -0,0 +1,223 @@ +------------------------------------------------- +-- encoding tests +------------------------------------------------- +set client_encoding = 'utf8'; +-- google translate says: +-- column: コラム +-- table: テーブル +-- client data: クライアント側のデータ +-- proxy data: プロキシデータ +-- remote data: リモートデータ +-- argument: 引数 +set client_min_messages = 'warning'; +drop database if exists test_enc_proxy; +drop database if exists test_enc_part; +create database test_enc_proxy with encoding 'euc_jp'; +create database test_enc_part with encoding 'utf-8'; +-- initialize proxy db +\c test_enc_proxy +set client_encoding = 'utf-8'; +create language plpgsql; +\i plproxy.sql +-- handler function +CREATE FUNCTION plproxy_call_handler () +RETURNS language_handler AS '$libdir/plproxy' LANGUAGE C; +-- language +CREATE LANGUAGE plproxy HANDLER plproxy_call_handler; +create schema plproxy; +create or replace function plproxy.get_cluster_version(cluster_name text) +returns integer as $$ begin return 1; end; $$ language plpgsql; +create or replace function plproxy.get_cluster_config(cluster_name text, out key text, out val text) +returns setof record as $$ begin return; end; $$ language plpgsql; +create or replace function plproxy.get_cluster_partitions(cluster_name text) +returns setof text as $$ begin + return next 'host=127.0.0.1 dbname=test_enc_part'; return; +end; $$ language plpgsql; +create table intl_data (id int4, "コラム" text); +create function test_encoding() returns setof intl_data as $$ + cluster 'testcluster'; run on 0; select * from intl_data order by 1; +$$ language plproxy; +create function test_encoding2(text) returns setof intl_data as $$ + cluster 'testcluster'; run on 0; + select 0 as id, $1 as "コラム"; +$$ language plproxy; +create function test_encoding3(text) returns setof intl_data as $$ + cluster 'testcluster'; run on 0; +$$ language plproxy; +-- initialize part db +\c test_enc_part +create language plpgsql; +set client_encoding = 'utf8'; +create table intl_data (id int4, "コラム" text); +insert into intl_data values (1, 'リモートデータ'); +create function test_encoding3(text) +returns setof intl_data as $$ +declare rec intl_data%rowtype; +begin + raise notice 'got: %', $1; + rec := (3, $1); + return next rec; return; +end; $$ language plpgsql; +set client_encoding = 'sjis'; +select * from intl_data order by 1; + id | ƒRƒ‰ƒ€ +----+---------------- + 1 | ƒŠƒ‚[ƒgƒf[ƒ^ +(1 row) + +set client_encoding = 'euc_jp'; +select * from intl_data order by 1; + id | ¥³¥é¥E +----+---------------- + 1 | ¥E⡼¥È¥Ç¡¼¥¿ +(1 row) + +set client_encoding = 'utf-8'; +select * from intl_data order by 1; + id | コラム +----+---------------- + 1 | リモートデータ +(1 row) + +-- test +\c test_enc_proxy +set client_encoding = 'sjis'; +select * from test_encoding(); + id | ƒRƒ‰ƒ€ +----+---------------- + 1 | ƒŠƒ‚[ƒgƒf[ƒ^ +(1 row) + +set client_encoding = 'euc_jp'; +select * from test_encoding(); + id | ¥³¥é¥E +----+---------------- + 1 | ¥E⡼¥È¥Ç¡¼¥¿ +(1 row) + +set client_encoding = 'utf8'; +select * from test_encoding(); + id | コラム +----+---------------- + 1 | リモートデータ +(1 row) + +select * from test_encoding2('クライアント側のデータ'); + id | コラム +----+------------------------ + 0 | クライアントåEのチEEタ +(1 row) + +select * from test_encoding3('クライアント側のデータ'); + id | コラム +----+------------------------ + 3 | クライアントåEのチEEタ +(1 row) + +\c template1 +set client_min_messages = 'warning'; +drop database if exists test_enc_proxy; +drop database if exists test_enc_part; +create database test_enc_proxy with encoding 'utf-8'; +create database test_enc_part with encoding 'euc_jp'; +-- initialize proxy db +\c test_enc_proxy +create language plpgsql; +\i plproxy.sql +-- handler function +CREATE FUNCTION plproxy_call_handler () +RETURNS language_handler AS '$libdir/plproxy' LANGUAGE C; +-- language +CREATE LANGUAGE plproxy HANDLER plproxy_call_handler; +set client_encoding = 'utf8'; +create schema plproxy; +create or replace function plproxy.get_cluster_version(cluster_name text) +returns integer as $$ begin return 1; end; $$ language plpgsql; +create or replace function plproxy.get_cluster_config(cluster_name text, out key text, out val text) +returns setof record as $$ begin return; end; $$ language plpgsql; +create or replace function plproxy.get_cluster_partitions(cluster_name text) +returns setof text as $$ begin + return next 'host=127.0.0.1 dbname=test_enc_part'; return; +end; $$ language plpgsql; +create table intl_data (id int4, "コラム" text); +create function test_encoding() returns setof intl_data as $$ + cluster 'testcluster'; run on 0; select * from intl_data order by 1; +$$ language plproxy; +create function test_encoding2(text) returns setof intl_data as $$ + cluster 'testcluster'; run on 0; + select 0 as id, $1 as "コラム"; +$$ language plproxy; +create function test_encoding3(text) returns setof intl_data as $$ + cluster 'testcluster'; run on 0; +$$ language plproxy; +-- initialize part db +\c test_enc_part +create language plpgsql; +set client_encoding = 'utf8'; +create table intl_data (id int4, "コラム" text); +insert into intl_data values (1, 'リモートデータ'); +create function test_encoding3(text) +returns setof intl_data as $$ +declare rec intl_data%rowtype; +begin + raise notice 'got: %', $1; + rec := (3, $1); + return next rec; return; +end; $$ language plpgsql; +set client_encoding = 'sjis'; +select * from intl_data order by 1; + id | ƒRƒ‰ƒ€ +----+---------------- + 1 | ƒŠƒ‚[ƒgƒf[ƒ^ +(1 row) + +set client_encoding = 'euc_jp'; +select * from intl_data order by 1; + id | ¥³¥é¥E +----+---------------- + 1 | ¥E⡼¥È¥Ç¡¼¥¿ +(1 row) + +set client_encoding = 'utf-8'; +select * from intl_data order by 1; + id | コラム +----+---------------- + 1 | リモートデータ +(1 row) + +-- test +\c test_enc_proxy +set client_encoding = 'utf8'; +set client_encoding = 'sjis'; +select * from test_encoding(); + id | ƒRƒ‰ƒ€ +----+---------------- + 1 | ƒŠƒ‚[ƒgƒf[ƒ^ +(1 row) + +set client_encoding = 'euc_jp'; +select * from test_encoding(); + id | ¥³¥é¥E +----+---------------- + 1 | ¥E⡼¥È¥Ç¡¼¥¿ +(1 row) + +set client_encoding = 'utf-8'; +select * from test_encoding(); + id | コラム +----+---------------- + 1 | リモートデータ +(1 row) + +select * from test_encoding2('クライアント側のデータ'); + id | コラム +----+------------------------ + 0 | クライアントåEのチEEタ +(1 row) + +select * from test_encoding3('クライアント側のデータ'); + id | コラム +----+------------------------ + 3 | クライアントåEのチEEタ +(1 row) + -- 2.39.5