Fix outdated src/test/mb/ tests, and add a GB18030 test.

The expected-output files for these tests were broken by the recent
addition of a warning for hash indexes.  Update them.

Also add a test case for GB18030 encoding, similar to the other ones.
This is a pretty weak test, but it's better than nothing.
This commit is contained in:
Tom Lane 2015-05-15 13:47:42 -04:00
parent 8b0f105d2d
commit 07af523870
10 changed files with 124 additions and 1 deletions

View File

@ -2,6 +2,7 @@ drop table
create table 廠商資料 (行業別 text, 公司抬頭 varchar, 地址 varchar(16));
create index 廠商資料index1 on 廠商資料 using btree (行業別);
create index 廠商資料index2 on 廠商資料 using hash (公司抬頭);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 廠商資料 values ('電腦業', '達達科技', '北A01仁');
insert into 廠商資料 values ('製造業', '財源有限公司', '中B10中');
insert into 廠商資料 values ('餐飲業', '美味股份有限公司', '高Z01九');

View File

@ -3,6 +3,7 @@ ERROR: table "
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16));
create index 計算機用語index1 on 計算機用語 using btree (用語);
create index 計算機用語index2 on 計算機用語 using hash (分類コード);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 計算機用語 values('コンピュータディスプレイ','機A01上');
insert into 計算機用語 values('コンピュータグラフィックス','分B10中');
insert into 計算機用語 values('コンピュータプログラマー','人Z01下');

View File

@ -3,6 +3,7 @@ ERROR: table "ͪߩѦ
create table 計算機용어 (용어 text, 分類코드 varchar, 비고1A라구 char(16));
create index 計算機용어index1 on 計算機용어 using btree (용어);
create index 計算機용어index2 on 計算機용어 using hash (分類코드);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 計算機용어 values('컴퓨터디스플레이', '機A01上');
insert into 計算機용어 values('컴퓨터그래픽스', '分B10中');
insert into 計算機용어 values('컴퓨터프로그래머', '人Z01下');

View File

@ -3,6 +3,7 @@ ERROR: table "
create table 燹俑骜砧 (如淦杀 text, 狞瞥婉螭 varchar, 氢蛇 varchar(16));
create index 燹俑骜砧index1 on 燹俑骜砧 using btree (如淦杀);
create index 燹俑骜砧index2 on 燹俑骜砧 using hash (狞瞥婉螭);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 燹俑骜砧 values ('缳妾淦', '绠绠绎世', '啤A01念');
insert into 燹俑骜砧 values ('犒葸淦', '芈溷却宇狞瞥', '你B10你');
insert into 燹俑骜砧 values ('螫悖淦', '印汤洗枪却宇狞瞥', '仨Z01摩');

View File

@ -0,0 +1,87 @@
drop table 計算機用語;
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16));
create index 計算機用語index1 on 計算機用語 using btree (用語);
create index 計算機用語index2 on 計算機用語 using hash (分類コード);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 計算機用語 values('コンピュータディスプレイ','機A01上');
insert into 計算機用語 values('コンピュータグラフィックス','分B10中');
insert into 計算機用語 values('コンピュータプログラマー','人Z01下');
vacuum 計算機用語;
select * from 計算機用語;
用語 | 分類コード | 備考1aだよ
----------------------------+------------+------------
コンピュータディスプレイ | 機A01上 |
コンピュータグラフィックス | 分B10中 |
コンピュータプログラマー | 人Z01下 |
(3 rows)
select * from 計算機用語 where 分類コード = '人Z01下';
用語 | 分類コード | 備考1aだよ
--------------------------+------------+------------
コンピュータプログラマー | 人Z01下 |
(1 row)
select * from 計算機用語 where 分類コード ~* '人z01下';
用語 | 分類コード | 備考1aだよ
--------------------------+------------+------------
コンピュータプログラマー | 人Z01下 |
(1 row)
select * from 計算機用語 where 分類コード like '_Z01_';
用語 | 分類コード | 備考1aだよ
--------------------------+------------+------------
コンピュータプログラマー | 人Z01下 |
(1 row)
select * from 計算機用語 where 分類コード like '_Z%';
用語 | 分類コード | 備考1aだよ
--------------------------+------------+------------
コンピュータプログラマー | 人Z01下 |
(1 row)
select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]';
用語 | 分類コード | 備考1aだよ
----------------------------+------------+------------
コンピュータディスプレイ | 機A01上 |
コンピュータグラフィックス | 分B10中 |
(2 rows)
select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]';
用語 | 分類コード | 備考1aだよ
----------------------------+------------+------------
コンピュータディスプレイ | 機A01上 |
コンピュータグラフィックス | 分B10中 |
(2 rows)
select *,character_length(用語) from 計算機用語;
用語 | 分類コード | 備考1aだよ | character_length
----------------------------+------------+------------+------------------
コンピュータディスプレイ | 機A01上 | | 12
コンピュータグラフィックス | 分B10中 | | 13
コンピュータプログラマー | 人Z01下 | | 12
(3 rows)
select *,octet_length(用語) from 計算機用語;
用語 | 分類コード | 備考1aだよ | octet_length
----------------------------+------------+------------+--------------
コンピュータディスプレイ | 機A01上 | | 36
コンピュータグラフィックス | 分B10中 | | 39
コンピュータプログラマー | 人Z01下 | | 36
(3 rows)
select *,position('デ' in 用語) from 計算機用語;
用語 | 分類コード | 備考1aだよ | position
----------------------------+------------+------------+----------
コンピュータディスプレイ | 機A01上 | | 7
コンピュータグラフィックス | 分B10中 | | 0
コンピュータプログラマー | 人Z01下 | | 0
(3 rows)
select *,substring(用語 from 10 for 4) from 計算機用語;
用語 | 分類コード | 備考1aだよ | substring
----------------------------+------------+------------+-----------
コンピュータディスプレイ | 機A01上 | | プレイ
コンピュータグラフィックス | 分B10中 | | ィックス
コンピュータプログラマー | 人Z01下 | | ラマー
(3 rows)

View File

@ -3,6 +3,7 @@ ERROR: table "
create table ’·×’»»’µ¡’ÍÑ’¸ì (’ÍÑ’¸ì text, ’ʬ’Îà’¥³’¡¼’¥É varchar, È÷¹Í1A¤À¤è char(16));
create index ·×»»µ¡ÍѸìindex1 on ’·×’»»’µ¡’ÍÑ’¸ì using btree (’ÍÑ’¸ì);
create index ·×»»µ¡ÍѸìindex2 on ’·×’»»’µ¡’ÍÑ’¸ì using hash (’ʬ’Îà’¥³’¡¼’¥É);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into ’·×’»»’µ¡’ÍÑ’¸ì values('’¥³’¥ó’¥Ô’¥å’¡¼’¥¿’¥Ç’¥£’¥¹’¥×’¥ì’¥¤','µ¡A01¾å');
insert into ’·×’»»’µ¡’ÍÑ’¸ì values('’¥³’¥ó’¥Ô’¥å’¡¼’¥¿’¥°’¥é’¥Õ’¥£’¥Ã’¥¯’¥¹','ʬB10Ãæ');
insert into ’·×’»»’µ¡’ÍÑ’¸ì values('’¥³’¥ó’¥Ô’¥å’¡¼’¥¿’¥×’¥í’¥°’¥é’¥Þ’¡¼','¿ÍZ01²¼');
@ -177,6 +178,7 @@ ERROR: table "
create table “ͪ“ß©“Ѧ“¿ë“¾î (“¿ë“¾î text, “Ý“׾“ÄÚ“µå varchar, “ºñ“°í1A“¶ó“±¸ char(16));
create index “ͪ“ß©“Ѧ“¿ë“¾îindex1 on “ͪ“ß©“Ѧ“¿ë“¾î using btree (“¿ë“¾î);
create index “ͪ“ß©“Ѧ“¿ë“¾îindex2 on “ͪ“ß©“Ѧ“¿ë“¾î using hash (“Ý“׾“ÄÚ“µå);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into “ͪ“ß©“Ѧ“¿ë“¾î values('“Äēǻ“ÅÍ“µð“½º“ÇÓ·¹“ÀÌ', '“ѦA01“ß¾');
insert into “ͪ“ß©“Ѧ“¿ë“¾î values('“Äēǻ“ÅÍ“±×“·¡“ÇÈ“½º', '“ÝÂB10“ñé');
insert into “ͪ“ß©“Ѧ“¿ë“¾î values('“Äēǻ“ÅÍ“ÇÁ“·Î“±×“·¡“¸Ó', '“ìÑZ01“ù»');

View File

@ -2,6 +2,7 @@ drop table
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16));
create index 計算機用語index1 on 計算機用語 using btree (用語);
create index 計算機用語index2 on 計算機用語 using hash (分類コード);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 計算機用語 values('コンピュータディスプレイ','機A01上');
insert into 計算機用語 values('コンピュータグラフィックス','分B10中');
insert into 計算機用語 values('コンピュータプログラマー','人Z01下');

View File

@ -3,6 +3,7 @@ ERROR: table "計算機用語" does not exist
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16));
create index 計算機用語index1 on 計算機用語 using btree (用語);
create index 計算機用語index2 on 計算機用語 using hash (分類コード);
WARNING: hash indexes are not WAL-logged and their use is discouraged
insert into 計算機用語 values('コンピュータディスプレイ','機A01上');
insert into 計算機用語 values('コンピュータグラフィックス','分B10中');
insert into 計算機用語 values('コンピュータプログラマー','人Z01下');

View File

@ -18,7 +18,11 @@ dropdb --if-exists utf8
createdb -T template0 -l C -E UTF8 utf8 || exit 1
PSQL="psql -n -e -q"
tests="euc_jp sjis euc_kr euc_cn euc_tw big5 utf8 mule_internal"
# in the test list, client-only encodings must follow the server encoding
# they're to be tested with; see hard-coded cases below
tests="euc_jp sjis euc_kr euc_cn euc_tw big5 utf8 gb18030 mule_internal"
EXITCODE=0
unset PGCLIENTENCODING
@ -36,6 +40,11 @@ do
export PGCLIENTENCODING
$PSQL euc_tw < sql/big5.sql > results/big5.out 2>&1
unset PGCLIENTENCODING
elif [ $i = gb18030 ];then
PGCLIENTENCODING=GB18030
export PGCLIENTENCODING
$PSQL utf8 < sql/gb18030.sql > results/gb18030.out 2>&1
unset PGCLIENTENCODING
else
dropdb $i >/dev/null 2>&1
createdb -T template0 -l C -E `echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` $i >/dev/null

View File

@ -0,0 +1,19 @@
drop table ;
create table ( text, varchar, 1Aだよ char(16));
create index index1 on using btree ();
create index index2 on using hash ();
insert into values('コンピュータディスプレイ','機A01上');
insert into values('コンピュータグラフィックス','分B10中');
insert into values('コンピュータプログラマー','人Z01下');
vacuum ;
select * from ;
select * from where = '人Z01下';
select * from where ~* '人z01下';
select * from where like '_Z01_';
select * from where like '_Z%';
select * from where ~ 'コンピュータ[デグ]';
select * from where ~* 'コンピュータ[デグ]';
select *,character_length() from ;
select *,octet_length() from ;
select *,position('' in ) from ;
select *,substring( from 10 for 4) from ;