Fix outdated src/test/mb/ tests, and add a GB18030 test.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 15 May 2015 17:47:42 +0000 (13:47 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 15 May 2015 17:47:42 +0000 (13:47 -0400)
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.

src/test/mb/expected/big5.out
src/test/mb/expected/euc_jp.out
src/test/mb/expected/euc_kr.out
src/test/mb/expected/euc_tw.out
src/test/mb/expected/gb18030.out [new file with mode: 0644]
src/test/mb/expected/mule_internal.out
src/test/mb/expected/sjis.out
src/test/mb/expected/utf8.out
src/test/mb/mbregress.sh
src/test/mb/sql/gb18030.sql [new file with mode: 0644]

index 97100cd0a2d049fcc7c8e218070320664e49437a..d7a6097e612e8182720285c83d2fb2391783bb01 100644 (file)
@@ -2,6 +2,7 @@ drop table 
 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');
index 15f83e0231cc29c6d565dde9053ca94c49fd4788..be248d91359a56049cb0b00d936cc12473be4c68 100644 (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²¼');
index 229ffd8f971543b1cd3422435826201bd57331dc..837f2e60d078180339ee70dc65bb05fca0cd4eb5 100644 (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ù»');
index 99eb4884e12668fe9c4abbe0ab21bbf12fb2e697..f224e7820d5ddbd392f73d1aba0edd611f65e50d 100644 (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Ħ');
diff --git a/src/test/mb/expected/gb18030.out b/src/test/mb/expected/gb18030.out
new file mode 100644 (file)
index 0000000..562852b
--- /dev/null
@@ -0,0 +1,87 @@
+drop table Ó\8bËã\99CÓÃÕZ;
+create table Ó\8bËã\99CÓÃÕZ (ÓÃÕZ text, ·Öî\90¥³©`¥É varchar, \82俼1A¤À¤è char(16));
+create index Ó\8bËã\99CÓÃÕZindex1 on Ó\8bËã\99CÓÃÕZ using btree (ÓÃÕZ);
+create index Ó\8bËã\99CÓÃÕZindex2 on Ó\8bËã\99CÓÃÕZ using hash (·Öî\90¥³©`¥É);
+WARNING:  hash indexes are not WAL-logged and their use is discouraged
+insert into Ó\8bËã\99CÓÃÕZ values('¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤','\99CA01ÉÏ');
+insert into Ó\8bËã\99CÓÃÕZ values('¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹','·ÖB10ÖÐ');
+insert into Ó\8bËã\99CÓÃÕZ values('¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`','ÈËZ01ÏÂ');
+vacuum Ó\8bËã\99CÓÃÕZ;
+select * from Ó\8bËã\99CÓÃÕZ;
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+----------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    | 
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   | 
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`   | ÈËZ01Ï    | 
+(3 rows)
+
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É = 'ÈËZ01ÏÂ';
+           ÓÃÕZ           | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+--------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©` | ÈËZ01Ï    | 
+(1 row)
+
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É ~* 'ÈËz01ÏÂ';
+           ÓÃÕZ           | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+--------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©` | ÈËZ01Ï    | 
+(1 row)
+
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É like '_Z01_';
+           ÓÃÕZ           | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+--------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©` | ÈËZ01Ï    | 
+(1 row)
+
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É like '_Z%';
+           ÓÃÕZ           | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+--------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©` | ÈËZ01Ï    | 
+(1 row)
+
+select * from Ó\8bËã\99CÓÃÕZ where ÓÃÕZ ~ '¥³¥ó¥Ô¥å©`¥¿[¥Ç¥°]';
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+----------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    | 
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   | 
+(2 rows)
+
+select * from Ó\8bËã\99CÓÃÕZ where ÓÃÕZ ~* '¥³¥ó¥Ô¥å©`¥¿[¥Ç¥°]';
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è 
+----------------------------+------------+------------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    | 
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   | 
+(2 rows)
+
+select *,character_length(ÓÃÕZ) from Ó\8bËã\99CÓÃÕZ;
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è | character_length 
+----------------------------+------------+------------+------------------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    |            |               12
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   |            |               13
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`   | ÈËZ01Ï    |            |               12
+(3 rows)
+
+select *,octet_length(ÓÃÕZ) from Ó\8bËã\99CÓÃÕZ;
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è | octet_length 
+----------------------------+------------+------------+--------------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    |            |           36
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   |            |           39
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`   | ÈËZ01Ï    |            |           36
+(3 rows)
+
+select *,position('¥Ç' in ÓÃÕZ) from Ó\8bËã\99CÓÃÕZ;
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è | position 
+----------------------------+------------+------------+----------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    |            |        7
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   |            |        0
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`   | ÈËZ01Ï    |            |        0
+(3 rows)
+
+select *,substring(ÓÃÕZ from 10 for 4) from Ó\8bËã\99CÓÃÕZ;
+            ÓÃÕZ            | ·Öî\90¥³©`¥É | \82俼1a¤À¤è | substring 
+----------------------------+------------+------------+-----------
+ ¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤   | \99CA01ÉÏ    |            | ¥×¥ì¥¤
+ ¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹ | ·ÖB10ÖР   |            | ¥£¥Ã¥¯¥¹
+ ¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`   | ÈËZ01Ï    |            | ¥é¥Þ©`
+(3 rows)
+
index ac8b57dc4216fd68bc74ef774a934cef1f3db707..67f7775706efd89c8da15cf6c33f1fabf103cf4b 100644 (file)
@@ -3,6 +3,7 @@ ERROR:  table "
 create table \92·×\92»»\92µ¡\92ÍÑ\92¸ì (\92ÍÑ\92¸ì text, \92ʬ\92Îà\92¥³\92¡¼\92¥É varchar, \92È÷\92¹Í1A\92¤À\92¤è char(16));
 create index \92·×\92»»\92µ¡\92ÍÑ\92¸ìindex1 on \92·×\92»»\92µ¡\92ÍÑ\92¸ì using btree (\92ÍÑ\92¸ì);
 create index \92·×\92»»\92µ¡\92ÍÑ\92¸ìindex2 on \92·×\92»»\92µ¡\92ÍÑ\92¸ì using hash (\92ʬ\92Îà\92¥³\92¡¼\92¥É);
+WARNING:  hash indexes are not WAL-logged and their use is discouraged
 insert into \92·×\92»»\92µ¡\92ÍÑ\92¸ì values('\92¥³\92¥ó\92¥Ô\92¥å\92¡¼\92¥¿\92¥Ç\92¥£\92¥¹\92¥×\92¥ì\92¥¤','\92µ¡A01\92¾å');
 insert into \92·×\92»»\92µ¡\92ÍÑ\92¸ì values('\92¥³\92¥ó\92¥Ô\92¥å\92¡¼\92¥¿\92¥°\92¥é\92¥Õ\92¥£\92¥Ã\92¥¯\92¥¹','\92ʬB10\92Ãæ');
 insert into \92·×\92»»\92µ¡\92ÍÑ\92¸ì values('\92¥³\92¥ó\92¥Ô\92¥å\92¡¼\92¥¿\92¥×\92¥í\92¥°\92¥é\92¥Þ\92¡¼','\92¿ÍZ01\92²¼');
@@ -177,6 +178,7 @@ ERROR:  table "
 create table \93ͪ\93ß©\93Ѧ\93¿ë\93¾î (\93¿ë\93¾î text, \93ÝÂ\93×¾\93ÄÚ\93µå varchar, \93ºñ\93°í1A\93¶ó\93±¸ char(16));
 create index \93ͪ\93ß©\93Ѧ\93¿ë\93¾îindex1 on \93ͪ\93ß©\93Ѧ\93¿ë\93¾î using btree (\93¿ë\93¾î);
 create index \93ͪ\93ß©\93Ѧ\93¿ë\93¾îindex2 on \93ͪ\93ß©\93Ѧ\93¿ë\93¾î using hash (\93ÝÂ\93×¾\93ÄÚ\93µå);
+WARNING:  hash indexes are not WAL-logged and their use is discouraged
 insert into \93ͪ\93ß©\93Ѧ\93¿ë\93¾î values('\93ÄÄ\93Ç»\93ÅÍ\93µð\93½º\93ÇÃ\93·¹\93ÀÌ', '\93ѦA01\93ß¾');
 insert into \93ͪ\93ß©\93Ѧ\93¿ë\93¾î values('\93ÄÄ\93Ç»\93ÅÍ\93±×\93·¡\93ÇÈ\93½º', '\93ÝÂB10\93ñé');
 insert into \93ͪ\93ß©\93Ѧ\93¿ë\93¾î values('\93ÄÄ\93Ç»\93ÅÍ\93ÇÁ\93·Î\93±×\93·¡\93¸Ó', '\93ìÑZ01\93ù»');
index db2bfd0d755ef11396df00242d6af51f6a62fa4a..73dd29b984394fc515af7b99e55824b5719fc6a6 100644 (file)
@@ -2,6 +2,7 @@ drop table 
 create table \8cv\8eZ\8b@\97p\8cê (\97p\8cê text, \95ª\97Þ\83R\81[\83h varchar, \94õ\8dl1A\82¾\82æ char(16));
 create index \8cv\8eZ\8b@\97p\8cêindex1 on \8cv\8eZ\8b@\97p\8cê using btree (\97p\8cê);
 create index \8cv\8eZ\8b@\97p\8cêindex2 on \8cv\8eZ\8b@\97p\8cê using hash (\95ª\97Þ\83R\81[\83h);
+WARNING:  hash indexes are not WAL-logged and their use is discouraged
 insert into \8cv\8eZ\8b@\97p\8cê values('\83R\83\93\83s\83\85\81[\83^\83f\83B\83X\83v\83\8c\83C','\8b@A01\8fã');
 insert into \8cv\8eZ\8b@\97p\8cê values('\83R\83\93\83s\83\85\81[\83^\83O\83\89\83t\83B\83b\83N\83X','\95ªB10\92\86');
 insert into \8cv\8eZ\8b@\97p\8cê values('\83R\83\93\83s\83\85\81[\83^\83v\83\8d\83O\83\89\83}\81[','\90lZ01\89º');
index 8f9f63c7e0e5718f9942e8b80530dcd0f3309bd7..715f3468374ac7dd7bd36a2f321cc512e9d7ffa2 100644 (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下');
index 03e590c9fc6d19c8bf6e6b92416e7825f6514f25..1efa0326c7f856e0bab60e0d7aa360f9bb9d9777 100755 (executable)
@@ -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 (file)
index 0000000..91ecaaa
--- /dev/null
@@ -0,0 +1,19 @@
+drop table Ó\8bËã\99CÓÃÕZ;
+create table Ó\8bËã\99CÓÃÕZ (ÓÃÕZ text, ·Öî\90¥³©`¥É varchar, \82俼1A¤À¤è char(16));
+create index Ó\8bËã\99CÓÃÕZindex1 on Ó\8bËã\99CÓÃÕZ using btree (ÓÃÕZ);
+create index Ó\8bËã\99CÓÃÕZindex2 on Ó\8bËã\99CÓÃÕZ using hash (·Öî\90¥³©`¥É);
+insert into Ó\8bËã\99CÓÃÕZ values('¥³¥ó¥Ô¥å©`¥¿¥Ç¥£¥¹¥×¥ì¥¤','\99CA01ÉÏ');
+insert into Ó\8bËã\99CÓÃÕZ values('¥³¥ó¥Ô¥å©`¥¿¥°¥é¥Õ¥£¥Ã¥¯¥¹','·ÖB10ÖÐ');
+insert into Ó\8bËã\99CÓÃÕZ values('¥³¥ó¥Ô¥å©`¥¿¥×¥í¥°¥é¥Þ©`','ÈËZ01ÏÂ');
+vacuum Ó\8bËã\99CÓÃÕZ;
+select * from Ó\8bËã\99CÓÃÕZ;
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É = 'ÈËZ01ÏÂ';
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É ~* 'ÈËz01ÏÂ';
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É like '_Z01_';
+select * from Ó\8bËã\99CÓÃÕZ where ·Öî\90¥³©`¥É like '_Z%';
+select * from Ó\8bËã\99CÓÃÕZ where ÓÃÕZ ~ '¥³¥ó¥Ô¥å©`¥¿[¥Ç¥°]';
+select * from Ó\8bËã\99CÓÃÕZ where ÓÃÕZ ~* '¥³¥ó¥Ô¥å©`¥¿[¥Ç¥°]';
+select *,character_length(ÓÃÕZ) from Ó\8bËã\99CÓÃÕZ;
+select *,octet_length(ÓÃÕZ) from Ó\8bËã\99CÓÃÕZ;
+select *,position('¥Ç' in ÓÃÕZ) from Ó\8bËã\99CÓÃÕZ;
+select *,substring(ÓÃÕZ from 10 for 4) from Ó\8bËã\99CÓÃÕZ;