diff options
author | Tom Lane | 2015-05-15 17:47:42 +0000 |
---|---|---|
committer | Tom Lane | 2015-05-15 17:47:42 +0000 |
commit | 07af523870bcfe930134054febd3a6a114942e5b (patch) | |
tree | e8b7a30eb5f69336509888414826bb754acae78e /src | |
parent | 8b0f105d2d179dc1085b16f0594c8fa78d13267d (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/mb/expected/big5.out | 1 | ||||
-rw-r--r-- | src/test/mb/expected/euc_jp.out | 1 | ||||
-rw-r--r-- | src/test/mb/expected/euc_kr.out | 1 | ||||
-rw-r--r-- | src/test/mb/expected/euc_tw.out | 1 | ||||
-rw-r--r-- | src/test/mb/expected/gb18030.out | 87 | ||||
-rw-r--r-- | src/test/mb/expected/mule_internal.out | 2 | ||||
-rw-r--r-- | src/test/mb/expected/sjis.out | 1 | ||||
-rw-r--r-- | src/test/mb/expected/utf8.out | 1 | ||||
-rwxr-xr-x | src/test/mb/mbregress.sh | 11 | ||||
-rw-r--r-- | src/test/mb/sql/gb18030.sql | 19 |
10 files changed, 124 insertions, 1 deletions
diff --git a/src/test/mb/expected/big5.out b/src/test/mb/expected/big5.out index 97100cd0a2d..d7a6097e612 100644 --- a/src/test/mb/expected/big5.out +++ b/src/test/mb/expected/big5.out @@ -2,6 +2,7 @@ drop table �t�Ӹ��; create table �t�Ӹ�� (��~�O text, ���q���Y varchar, �a�} varchar(16)); create index �t�Ӹ��index1 on �t�Ӹ�� using btree (��~�O); create index �t�Ӹ��index2 on �t�Ӹ�� using hash (���q���Y); +WARNING: hash indexes are not WAL-logged and their use is discouraged insert into �t�Ӹ�� values ('�q���~', '�F�F���', '�_A01��'); insert into �t�Ӹ�� values ('�s�y�~', '�]���������q', '��B10��'); insert into �t�Ӹ�� values ('�\���~', '�����ѥ��������q', '��Z01�E'); diff --git a/src/test/mb/expected/euc_jp.out b/src/test/mb/expected/euc_jp.out index 15f83e0231c..be248d91359 100644 --- a/src/test/mb/expected/euc_jp.out +++ b/src/test/mb/expected/euc_jp.out @@ -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��'); diff --git a/src/test/mb/expected/euc_kr.out b/src/test/mb/expected/euc_kr.out index 229ffd8f971..837f2e60d07 100644 --- a/src/test/mb/expected/euc_kr.out +++ b/src/test/mb/expected/euc_kr.out @@ -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��'); diff --git a/src/test/mb/expected/euc_tw.out b/src/test/mb/expected/euc_tw.out index 99eb4884e12..f224e7820d5 100644 --- a/src/test/mb/expected/euc_tw.out +++ b/src/test/mb/expected/euc_tw.out @@ -3,6 +3,7 @@ ERROR: table "��ٸ����" does not exist 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Ħ'); diff --git a/src/test/mb/expected/gb18030.out b/src/test/mb/expected/gb18030.out new file mode 100644 index 00000000000..562852b6741 --- /dev/null +++ b/src/test/mb/expected/gb18030.out @@ -0,0 +1,87 @@ +drop table Ӌ��C���Z; +create table Ӌ��C���Z (���Z text, ����`�� varchar, �俼1A���� char(16)); +create index Ӌ��C���Zindex1 on Ӌ��C���Z using btree (���Z); +create index Ӌ��C���Zindex2 on Ӌ��C���Z using hash (����`��); +WARNING: hash indexes are not WAL-logged and their use is discouraged +insert into Ӌ��C���Z values('����ԥ�`���ǥ����ץ쥤','�CA01��'); +insert into Ӌ��C���Z values('����ԥ�`������ե��å���','��B10��'); +insert into Ӌ��C���Z values('����ԥ�`���ץ�����ީ`','��Z01��'); +vacuum Ӌ��C���Z; +select * from Ӌ��C���Z; + ���Z | ����`�� | �俼1a���� +----------------------------+------------+------------ + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | + ����ԥ�`������ե��å��� | ��B10�� | + ����ԥ�`���ץ�����ީ` | ��Z01�� | +(3 rows) + +select * from Ӌ��C���Z where ����`�� = '��Z01��'; + ���Z | ����`�� | �俼1a���� +--------------------------+------------+------------ + ����ԥ�`���ץ�����ީ` | ��Z01�� | +(1 row) + +select * from Ӌ��C���Z where ����`�� ~* '��z01��'; + ���Z | ����`�� | �俼1a���� +--------------------------+------------+------------ + ����ԥ�`���ץ�����ީ` | ��Z01�� | +(1 row) + +select * from Ӌ��C���Z where ����`�� like '_Z01_'; + ���Z | ����`�� | �俼1a���� +--------------------------+------------+------------ + ����ԥ�`���ץ�����ީ` | ��Z01�� | +(1 row) + +select * from Ӌ��C���Z where ����`�� like '_Z%'; + ���Z | ����`�� | �俼1a���� +--------------------------+------------+------------ + ����ԥ�`���ץ�����ީ` | ��Z01�� | +(1 row) + +select * from Ӌ��C���Z where ���Z ~ '����ԥ�`��[�ǥ�]'; + ���Z | ����`�� | �俼1a���� +----------------------------+------------+------------ + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | + ����ԥ�`������ե��å��� | ��B10�� | +(2 rows) + +select * from Ӌ��C���Z where ���Z ~* '����ԥ�`��[�ǥ�]'; + ���Z | ����`�� | �俼1a���� +----------------------------+------------+------------ + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | + ����ԥ�`������ե��å��� | ��B10�� | +(2 rows) + +select *,character_length(���Z) from Ӌ��C���Z; + ���Z | ����`�� | �俼1a���� | character_length +----------------------------+------------+------------+------------------ + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | | 12 + ����ԥ�`������ե��å��� | ��B10�� | | 13 + ����ԥ�`���ץ�����ީ` | ��Z01�� | | 12 +(3 rows) + +select *,octet_length(���Z) from Ӌ��C���Z; + ���Z | ����`�� | �俼1a���� | octet_length +----------------------------+------------+------------+-------------- + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | | 36 + ����ԥ�`������ե��å��� | ��B10�� | | 39 + ����ԥ�`���ץ�����ީ` | ��Z01�� | | 36 +(3 rows) + +select *,position('��' in ���Z) from Ӌ��C���Z; + ���Z | ����`�� | �俼1a���� | position +----------------------------+------------+------------+---------- + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | | 7 + ����ԥ�`������ե��å��� | ��B10�� | | 0 + ����ԥ�`���ץ�����ީ` | ��Z01�� | | 0 +(3 rows) + +select *,substring(���Z from 10 for 4) from Ӌ��C���Z; + ���Z | ����`�� | �俼1a���� | substring +----------------------------+------------+------------+----------- + ����ԥ�`���ǥ����ץ쥤 | �CA01�� | | �ץ쥤 + ����ԥ�`������ե��å��� | ��B10�� | | ���å��� + ����ԥ�`���ץ�����ީ` | ��Z01�� | | ��ީ` +(3 rows) + diff --git a/src/test/mb/expected/mule_internal.out b/src/test/mb/expected/mule_internal.out index ac8b57dc421..67f7775706e 100644 --- a/src/test/mb/expected/mule_internal.out +++ b/src/test/mb/expected/mule_internal.out @@ -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���'); @@ -177,6 +178,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���'); diff --git a/src/test/mb/expected/sjis.out b/src/test/mb/expected/sjis.out index db2bfd0d755..73dd29b9843 100644 --- a/src/test/mb/expected/sjis.out +++ b/src/test/mb/expected/sjis.out @@ -2,6 +2,7 @@ drop table �v�Z�@�p��; create table �v�Z�@�p�� (�p�� text, ���ރR�[�h varchar, ���l1A���� char(16)); create index �v�Z�@�p��index1 on �v�Z�@�p�� using btree (�p��); create index �v�Z�@�p��index2 on �v�Z�@�p�� using hash (���ރR�[�h); +WARNING: hash indexes are not WAL-logged and their use is discouraged insert into �v�Z�@�p�� values('�R���s���[�^�f�B�X�v���C','�@A01��'); insert into �v�Z�@�p�� values('�R���s���[�^�O���t�B�b�N�X','��B10��'); insert into �v�Z�@�p�� values('�R���s���[�^�v���O���}�[','�lZ01��'); diff --git a/src/test/mb/expected/utf8.out b/src/test/mb/expected/utf8.out index 8f9f63c7e0e..715f3468374 100644 --- a/src/test/mb/expected/utf8.out +++ b/src/test/mb/expected/utf8.out @@ -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下'); diff --git a/src/test/mb/mbregress.sh b/src/test/mb/mbregress.sh index 03e590c9fc6..1efa0326c7f 100755 --- a/src/test/mb/mbregress.sh +++ b/src/test/mb/mbregress.sh @@ -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 diff --git a/src/test/mb/sql/gb18030.sql b/src/test/mb/sql/gb18030.sql new file mode 100644 index 00000000000..91ecaaa973b --- /dev/null +++ b/src/test/mb/sql/gb18030.sql @@ -0,0 +1,19 @@ +drop table Ӌ��C���Z; +create table Ӌ��C���Z (���Z text, ����`�� varchar, �俼1A���� char(16)); +create index Ӌ��C���Zindex1 on Ӌ��C���Z using btree (���Z); +create index Ӌ��C���Zindex2 on Ӌ��C���Z using hash (����`��); +insert into Ӌ��C���Z values('����ԥ�`���ǥ����ץ쥤','�CA01��'); +insert into Ӌ��C���Z values('����ԥ�`������ե��å���','��B10��'); +insert into Ӌ��C���Z values('����ԥ�`���ץ�����ީ`','��Z01��'); +vacuum Ӌ��C���Z; +select * from Ӌ��C���Z; +select * from Ӌ��C���Z where ����`�� = '��Z01��'; +select * from Ӌ��C���Z where ����`�� ~* '��z01��'; +select * from Ӌ��C���Z where ����`�� like '_Z01_'; +select * from Ӌ��C���Z where ����`�� like '_Z%'; +select * from Ӌ��C���Z where ���Z ~ '����ԥ�`��[�ǥ�]'; +select * from Ӌ��C���Z where ���Z ~* '����ԥ�`��[�ǥ�]'; +select *,character_length(���Z) from Ӌ��C���Z; +select *,octet_length(���Z) from Ӌ��C���Z; +select *,position('��' in ���Z) from Ӌ��C���Z; +select *,substring(���Z from 10 for 4) from Ӌ��C���Z; |