Skip to content

Commit 07af523

Browse files
committed
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.
1 parent 8b0f105 commit 07af523

File tree

10 files changed

+124
-1
lines changed

10 files changed

+124
-1
lines changed

src/test/mb/expected/big5.out

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ drop table
22
create table �t�Ӹ�� (��~�O text, ���q���Y varchar, �a�} varchar(16));
33
create index �t�Ӹ��index1 on �t�Ӹ�� using btree (��~�O);
44
create index �t�Ӹ��index2 on �t�Ӹ�� using hash (���q���Y);
5+
WARNING: hash indexes are not WAL-logged and their use is discouraged
56
insert into �t�Ӹ�� values ('�q���~', '�F�F���', '�_A01��');
67
insert into �t�Ӹ�� values ('�s�y�~', '�]���������q', '��B10��');
78
insert into �t�Ӹ�� values ('�\���~', '�����ѥ��������q', '��Z01�E');

src/test/mb/expected/euc_jp.out

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ERROR: table "
33
create table �׻����Ѹ� (�Ѹ� text, ʬ�ॳ���� varchar, ����1A���� char(16));
44
create index �׻����Ѹ�index1 on �׻����Ѹ� using btree (�Ѹ�);
55
create index �׻����Ѹ�index2 on �׻����Ѹ� using hash (ʬ�ॳ����);
6+
WARNING: hash indexes are not WAL-logged and their use is discouraged
67
insert into �׻����Ѹ� values('����ԥ塼���ǥ����ץ쥤','��A01��');
78
insert into �׻����Ѹ� values('����ԥ塼������ե��å���','ʬB10��');
89
insert into �׻����Ѹ� values('����ԥ塼���ץ�����ޡ�','��Z01��');

src/test/mb/expected/euc_kr.out

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ERROR: table "ͪߩѦ
33
create table ͪߩѦ��� (��� text, ��׾�ڵ� varchar, ���1A�� char(16));
44
create index ͪߩѦ���index1 on ͪߩѦ��� using btree (���);
55
create index ͪߩѦ���index2 on ͪߩѦ��� using hash (��׾�ڵ�);
6+
WARNING: hash indexes are not WAL-logged and their use is discouraged
67
insert into ͪߩѦ��� values('��ǻ�͵��÷���', 'ѦA01߾');
78
insert into ͪߩѦ��� values('��ǻ�ͱ׷��Ƚ�', '��B10��');
89
insert into ͪߩѦ��� values('��ǻ�����α׷���', '��Z01��');

src/test/mb/expected/euc_tw.out

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ERROR: table "
33
create table ��ٸ���� (����ɱ text, ��Ƴ��� varchar, ���� varchar(16));
44
create index ��ٸ����index1 on ��ٸ���� using btree (����ɱ);
55
create index ��ٸ����index2 on ��ٸ���� using hash (��Ƴ���);
6+
WARNING: hash indexes are not WAL-logged and their use is discouraged
67
insert into ��ٸ���� values ('�����', '������', 'ơA01��');
78
insert into ��ٸ���� values ('������', '����ȴ����Ƴ', '��B10��');
89
insert into ��ٸ���� values ('����', 'ӡ��ϴǹȴ����Ƴ', '��Z01Ħ');

src/test/mb/expected/gb18030.out

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
drop table Ӌ��C���Z;
2+
create table Ӌ��C���Z (���Z text, ����`�� varchar, �俼1A���� char(16));
3+
create index Ӌ��C���Zindex1 on Ӌ��C���Z using btree (���Z);
4+
create index Ӌ��C���Zindex2 on Ӌ��C���Z using hash (����`��);
5+
WARNING: hash indexes are not WAL-logged and their use is discouraged
6+
insert into Ӌ��C���Z values('����ԥ�`���ǥ����ץ쥤','�CA01��');
7+
insert into Ӌ��C���Z values('����ԥ�`������ե��å���','��B10��');
8+
insert into Ӌ��C���Z values('����ԥ�`���ץ�����ީ`','��Z01��');
9+
vacuum Ӌ��C���Z;
10+
select * from Ӌ��C���Z;
11+
���Z | ����`�� | �俼1a����
12+
----------------------------+------------+------------
13+
����ԥ�`���ǥ����ץ쥤 | �CA01�� |
14+
����ԥ�`������ե��å��� | ��B10�� |
15+
����ԥ�`���ץ�����ީ` | ��Z01�� |
16+
(3 rows)
17+
18+
select * from Ӌ��C���Z where ����`�� = '��Z01��';
19+
���Z | ����`�� | �俼1a����
20+
--------------------------+------------+------------
21+
����ԥ�`���ץ�����ީ` | ��Z01�� |
22+
(1 row)
23+
24+
select * from Ӌ��C���Z where ����`�� ~* '��z01��';
25+
���Z | ����`�� | �俼1a����
26+
--------------------------+------------+------------
27+
����ԥ�`���ץ�����ީ` | ��Z01�� |
28+
(1 row)
29+
30+
select * from Ӌ��C���Z where ����`�� like '_Z01_';
31+
���Z | ����`�� | �俼1a����
32+
--------------------------+------------+------------
33+
����ԥ�`���ץ�����ީ` | ��Z01�� |
34+
(1 row)
35+
36+
select * from Ӌ��C���Z where ����`�� like '_Z%';
37+
���Z | ����`�� | �俼1a����
38+
--------------------------+------------+------------
39+
����ԥ�`���ץ�����ީ` | ��Z01�� |
40+
(1 row)
41+
42+
select * from Ӌ��C���Z where ���Z ~ '����ԥ�`��[�ǥ�]';
43+
���Z | ����`�� | �俼1a����
44+
----------------------------+------------+------------
45+
����ԥ�`���ǥ����ץ쥤 | �CA01�� |
46+
����ԥ�`������ե��å��� | ��B10�� |
47+
(2 rows)
48+
49+
select * from Ӌ��C���Z where ���Z ~* '����ԥ�`��[�ǥ�]';
50+
���Z | ����`�� | �俼1a����
51+
----------------------------+------------+------------
52+
����ԥ�`���ǥ����ץ쥤 | �CA01�� |
53+
����ԥ�`������ե��å��� | ��B10�� |
54+
(2 rows)
55+
56+
select *,character_length(���Z) from Ӌ��C���Z;
57+
���Z | ����`�� | �俼1a���� | character_length
58+
----------------------------+------------+------------+------------------
59+
����ԥ�`���ǥ����ץ쥤 | �CA01�� | | 12
60+
����ԥ�`������ե��å��� | ��B10�� | | 13
61+
����ԥ�`���ץ�����ީ` | ��Z01�� | | 12
62+
(3 rows)
63+
64+
select *,octet_length(���Z) from Ӌ��C���Z;
65+
���Z | ����`�� | �俼1a���� | octet_length
66+
----------------------------+------------+------------+--------------
67+
����ԥ�`���ǥ����ץ쥤 | �CA01�� | | 36
68+
����ԥ�`������ե��å��� | ��B10�� | | 39
69+
����ԥ�`���ץ�����ީ` | ��Z01�� | | 36
70+
(3 rows)
71+
72+
select *,position('��' in ���Z) from Ӌ��C���Z;
73+
���Z | ����`�� | �俼1a���� | position
74+
----------------------------+------------+------------+----------
75+
����ԥ�`���ǥ����ץ쥤 | �CA01�� | | 7
76+
����ԥ�`������ե��å��� | ��B10�� | | 0
77+
����ԥ�`���ץ�����ީ` | ��Z01�� | | 0
78+
(3 rows)
79+
80+
select *,substring(���Z from 10 for 4) from Ӌ��C���Z;
81+
���Z | ����`�� | �俼1a���� | substring
82+
----------------------------+------------+------------+-----------
83+
����ԥ�`���ǥ����ץ쥤 | �CA01�� | | �ץ쥤
84+
����ԥ�`������ե��å��� | ��B10�� | | ���å���
85+
����ԥ�`���ץ�����ީ` | ��Z01�� | | ��ީ`
86+
(3 rows)
87+

src/test/mb/expected/mule_internal.out

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ERROR: table "
33
create table ��ג�������ђ�� (��ђ�� text, �ʬ������������ varchar, ������1A������ char(16));
44
create index ��ג�������ђ��index1 on ��ג�������ђ�� using btree (��ђ��);
55
create index ��ג�������ђ��index2 on ��ג�������ђ�� using hash (�ʬ������������);
6+
WARNING: hash indexes are not WAL-logged and their use is discouraged
67
insert into ��ג�������ђ�� values('������Ԓ�咡������ǒ�������ג�쒥�','���A01���');
78
insert into ��ג�������ђ�� values('������Ԓ�咡���������钥Ւ����Ò�����','�ʬB10���');
89
insert into ��ג�������ђ�� values('������Ԓ�咡������ג�풥���钥ޒ��','���Z01���');
@@ -177,6 +178,7 @@ ERROR: table "
177178
create table �ͪ�ߩ�Ѧ��듾� (��듾� text, ��“׾��ړ�� varchar, ����1A��󓱸 char(16));
178179
create index �ͪ�ߩ�Ѧ��듾�index1 on �ͪ�ߩ�Ѧ��듾� using btree (��듾�);
179180
create index �ͪ�ߩ�Ѧ��듾�index2 on �ͪ�ߩ�Ѧ��듾� using hash (��“׾��ړ��);
181+
WARNING: hash indexes are not WAL-logged and their use is discouraged
180182
insert into �ͪ�ߩ�Ѧ��듾� values('��ēǻ��͓�𓽺��Ó�����', '�ѦA01�߾');
181183
insert into �ͪ�ߩ�Ѧ��듾� values('��ēǻ��͓�ד����ȓ��', '���B10���');
182184
insert into �ͪ�ߩ�Ѧ��듾� values('��ēǻ��͓����Γ�ד�����', '���Z01���');

src/test/mb/expected/sjis.out

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ drop table
22
create table �v�Z�@�p�� (�p�� text, ���ރR�[�h varchar, ���l1A���� char(16));
33
create index �v�Z�@�p��index1 on �v�Z�@�p�� using btree (�p��);
44
create index �v�Z�@�p��index2 on �v�Z�@�p�� using hash (���ރR�[�h);
5+
WARNING: hash indexes are not WAL-logged and their use is discouraged
56
insert into �v�Z�@�p�� values('�R���s���[�^�f�B�X�v���C','�@A01��');
67
insert into �v�Z�@�p�� values('�R���s���[�^�O���t�B�b�N�X','��B10��');
78
insert into �v�Z�@�p�� values('�R���s���[�^�v���O���}�[','�lZ01��');

src/test/mb/expected/utf8.out

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

src/test/mb/mbregress.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ dropdb --if-exists utf8
1818
createdb -T template0 -l C -E UTF8 utf8 || exit 1
1919

2020
PSQL="psql -n -e -q"
21-
tests="euc_jp sjis euc_kr euc_cn euc_tw big5 utf8 mule_internal"
21+
22+
# in the test list, client-only encodings must follow the server encoding
23+
# they're to be tested with; see hard-coded cases below
24+
tests="euc_jp sjis euc_kr euc_cn euc_tw big5 utf8 gb18030 mule_internal"
25+
2226
EXITCODE=0
2327

2428
unset PGCLIENTENCODING
@@ -36,6 +40,11 @@ do
3640
export PGCLIENTENCODING
3741
$PSQL euc_tw < sql/big5.sql > results/big5.out 2>&1
3842
unset PGCLIENTENCODING
43+
elif [ $i = gb18030 ];then
44+
PGCLIENTENCODING=GB18030
45+
export PGCLIENTENCODING
46+
$PSQL utf8 < sql/gb18030.sql > results/gb18030.out 2>&1
47+
unset PGCLIENTENCODING
3948
else
4049
dropdb $i >/dev/null 2>&1
4150
createdb -T template0 -l C -E `echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` $i >/dev/null

src/test/mb/sql/gb18030.sql

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
drop table 計算機用語;
2+
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16));
3+
create index 計算機用語index1 on 計算機用語 using btree (用語);
4+
create index 計算機用語index2 on 計算機用語 using hash (分類コード);
5+
insert into 計算機用語 values('コンピュータディスプレイ','機A01上');
6+
insert into 計算機用語 values('コンピュータグラフィックス','分B10中');
7+
insert into 計算機用語 values('コンピュータプログラマー','人Z01下');
8+
vacuum 計算機用語;
9+
select * from 計算機用語;
10+
select * from 計算機用語 where 分類コード = '人Z01下';
11+
select * from 計算機用語 where 分類コード ~* '人z01下';
12+
select * from 計算機用語 where 分類コード like '_Z01_';
13+
select * from 計算機用語 where 分類コード like '_Z%';
14+
select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]';
15+
select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]';
16+
select *,character_length(用語) from 計算機用語;
17+
select *,octet_length(用語) from 計算機用語;
18+
select *,position('' in 用語) from 計算機用語;
19+
select *,substring(用語 from 10 for 4) from 計算機用語;

0 commit comments

Comments
 (0)