summaryrefslogtreecommitdiffstats
path: root/src/test/mb
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/test/mb
parentInitial commit. (diff)
downloadpostgresql-14-46651ce6fe013220ed397add242004d764fc0153.tar.xz
postgresql-14-46651ce6fe013220ed397add242004d764fc0153.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/mb')
-rw-r--r--src/test/mb/README10
-rw-r--r--src/test/mb/expected/big5.out84
-rw-r--r--src/test/mb/expected/euc_cn.out87
-rw-r--r--src/test/mb/expected/euc_jp.out87
-rw-r--r--src/test/mb/expected/euc_kr.out87
-rw-r--r--src/test/mb/expected/euc_tw.out85
-rw-r--r--src/test/mb/expected/gb18030.out86
-rw-r--r--src/test/mb/expected/mule_internal.out333
-rw-r--r--src/test/mb/expected/sjis.out90
-rw-r--r--src/test/mb/expected/utf8.out87
-rwxr-xr-xsrc/test/mb/mbregress.sh74
-rw-r--r--src/test/mb/sql/big5.sql20
-rw-r--r--src/test/mb/sql/euc_cn.sql19
-rw-r--r--src/test/mb/sql/euc_jp.sql19
-rw-r--r--src/test/mb/sql/euc_kr.sql19
-rw-r--r--src/test/mb/sql/euc_tw.sql20
-rw-r--r--src/test/mb/sql/gb18030.sql19
-rw-r--r--src/test/mb/sql/mule_internal.sql72
-rw-r--r--src/test/mb/sql/sjis.sql20
-rw-r--r--src/test/mb/sql/utf8.sql19
20 files changed, 1337 insertions, 0 deletions
diff --git a/src/test/mb/README b/src/test/mb/README
new file mode 100644
index 0000000..632e8c3
--- /dev/null
+++ b/src/test/mb/README
@@ -0,0 +1,10 @@
+src/test/mb/README
+
+README for multibyte regression test
+ 1998/7/22
+ Tatsuo Ishii
+
+This directory contains a set of tests for multibyte supporting
+extensions for PostgreSQL. To run the test, simply type:
+
+% sh mbregress.sh
diff --git a/src/test/mb/expected/big5.out b/src/test/mb/expected/big5.out
new file mode 100644
index 0000000..97100cd
--- /dev/null
+++ b/src/test/mb/expected/big5.out
@@ -0,0 +1,84 @@
+drop table 廠商資料;
+create table 廠商資料 (行業別 text, 公司抬頭 varchar, 地址 varchar(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 廠商資料;
+ 行業別 | 公司抬頭 | 地址
+--------+------------------+---------
+ 電腦業 | 達達科技 | 北A01仁
+ 製造業 | 財源有限公司 | 中B10中
+ 餐飲業 | 美味股份有限公司 | 高Z01九
+(3 rows)
+
+select * from 廠商資料 where 地址 = '高Z01九';
+ 行業別 | 公司抬頭 | 地址
+--------+------------------+---------
+ 餐飲業 | 美味股份有限公司 | 高Z01九
+(1 row)
+
+select * from 廠商資料 where 地址 ~* '高z01九';
+ 行業別 | 公司抬頭 | 地址
+--------+------------------+---------
+ 餐飲業 | 美味股份有限公司 | 高Z01九
+(1 row)
+
+select * from 廠商資料 where 地址 like '_Z01_';
+ 行業別 | 公司抬頭 | 地址
+--------+------------------+---------
+ 餐飲業 | 美味股份有限公司 | 高Z01九
+(1 row)
+
+select * from 廠商資料 where 地址 like '_Z%';
+ 行業別 | 公司抬頭 | 地址
+--------+------------------+---------
+ 餐飲業 | 美味股份有限公司 | 高Z01九
+(1 row)
+
+select * from 廠商資料 where 公司抬頭 ~ '達達科[寄記技]';
+ 行業別 | 公司抬頭 | 地址
+--------+----------+---------
+ 電腦業 | 達達科技 | 北A01仁
+(1 row)
+
+select * from 廠商資料 where 公司抬頭 ~* '達達科[寄記技]';
+ 行業別 | 公司抬頭 | 地址
+--------+----------+---------
+ 電腦業 | 達達科技 | 北A01仁
+(1 row)
+
+select *, character_length(行業別) from 廠商資料;
+ 行業別 | 公司抬頭 | 地址 | character_length
+--------+------------------+---------+------------------
+ 電腦業 | 達達科技 | 北A01仁 | 3
+ 製造業 | 財源有限公司 | 中B10中 | 3
+ 餐飲業 | 美味股份有限公司 | 高Z01九 | 3
+(3 rows)
+
+select *, octet_length(行業別) from 廠商資料;
+ 行業別 | 公司抬頭 | 地址 | octet_length
+--------+------------------+---------+--------------
+ 電腦業 | 達達科技 | 北A01仁 | 6
+ 製造業 | 財源有限公司 | 中B10中 | 6
+ 餐飲業 | 美味股份有限公司 | 高Z01九 | 6
+(3 rows)
+
+select *, position('有限' in 公司抬頭) from 廠商資料;
+ 行業別 | 公司抬頭 | 地址 | position
+--------+------------------+---------+----------
+ 電腦業 | 達達科技 | 北A01仁 | 0
+ 製造業 | 財源有限公司 | 中B10中 | 3
+ 餐飲業 | 美味股份有限公司 | 高Z01九 | 5
+(3 rows)
+
+select *, substring(公司抬頭 from 3 for 6 ) from 廠商資料;
+ 行業別 | 公司抬頭 | 地址 | substring
+--------+------------------+---------+--------------
+ 電腦業 | 達達科技 | 北A01仁 | 科技
+ 製造業 | 財源有限公司 | 中B10中 | 有限公司
+ 餐飲業 | 美味股份有限公司 | 高Z01九 | 股份有限公司
+(3 rows)
+
diff --git a/src/test/mb/expected/euc_cn.out b/src/test/mb/expected/euc_cn.out
new file mode 100644
index 0000000..4d046fa
--- /dev/null
+++ b/src/test/mb/expected/euc_cn.out
@@ -0,0 +1,87 @@
+drop table 數呾儂扲逄;
+ERROR: table "數呾儂扲逄" does not exist
+create table 數呾儂扲逄(扲逄 text, 煦濬瘍 varchar, 掘蛁1A char(16));
+create index 數呾儂扲逄index1 on 數呾儂扲逄 using btree(扲逄);
+create index 數呾儂扲逄index2 on 數呾儂扲逄 using btree(煦濬瘍);
+insert into 數呾儂扲逄 values('萇齟珆尨そ','儂A01奻');
+insert into 數呾儂扲逄 values('萇齟芞倛','煦B01笢');
+insert into 數呾儂扲逄 values('萇齟最唗埜','汳01狟');
+vacuum 數呾儂扲逄;
+select * from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟珆尨そ | 儂A01奻 |
+ 萇齟芞倛 | 煦B01笢 |
+ 萇齟最唗埜 | 汳01狟 |
+(3 rows)
+
+select * from 數呾儂扲逄 where 煦濬瘍 = '汳01狟';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 煦濬瘍 ~* '芏01狟';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 煦濬瘍 like '_Z01_';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 煦濬瘍 like '_Z%';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 扲逄 ~ '萇齟[珆芞]';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟珆尨そ | 儂A01奻 |
+ 萇齟芞倛 | 煦B01笢 |
+(2 rows)
+
+select * from 數呾儂扲逄 where 扲逄 ~* '萇齟[珆芞]';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟珆尨そ | 儂A01奻 |
+ 萇齟芞倛 | 煦B01笢 |
+(2 rows)
+
+select *,character_length(扲逄) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | character_length
+------------+---------+--------+------------------
+ 萇齟珆尨そ | 儂A01奻 | | 5
+ 萇齟芞倛 | 煦B01笢 | | 4
+ 萇齟最唗埜 | 汳01狟 | | 5
+(3 rows)
+
+select *,octet_length(扲逄) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | octet_length
+------------+---------+--------+--------------
+ 萇齟珆尨そ | 儂A01奻 | | 10
+ 萇齟芞倛 | 煦B01笢 | | 8
+ 萇齟最唗埜 | 汳01狟 | | 10
+(3 rows)
+
+select *,position('珆' in 扲逄) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | position
+------------+---------+--------+----------
+ 萇齟珆尨そ | 儂A01奻 | | 3
+ 萇齟芞倛 | 煦B01笢 | | 0
+ 萇齟最唗埜 | 汳01狟 | | 0
+(3 rows)
+
+select *,substring(扲逄 from 3 for 4) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | substring
+------------+---------+--------+-----------
+ 萇齟珆尨そ | 儂A01奻 | | 珆尨そ
+ 萇齟芞倛 | 煦B01笢 | | 芞倛
+ 萇齟最唗埜 | 汳01狟 | | 最唗埜
+(3 rows)
+
diff --git a/src/test/mb/expected/euc_jp.out b/src/test/mb/expected/euc_jp.out
new file mode 100644
index 0000000..15f83e0
--- /dev/null
+++ b/src/test/mb/expected/euc_jp.out
@@ -0,0 +1,87 @@
+drop table 煌遙窗迕賄;
+ERROR: table "煌遙窗迕賄" does not exist
+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 煌遙窗迕賄;
+ 迕賄 | 坌挀戊□玉 | 鷞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曉 | | 24
+ 戊件疋亙□正弘仿白奴永弁旦 | 坌B10醱 | | 26
+ 戊件疋亙□正皿伕弘仿穴□ | 諦Z01票 | | 24
+(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)
+
diff --git a/src/test/mb/expected/euc_kr.out b/src/test/mb/expected/euc_kr.out
new file mode 100644
index 0000000..229ffd8
--- /dev/null
+++ b/src/test/mb/expected/euc_kr.out
@@ -0,0 +1,87 @@
+drop table 耵蓱悁辨橫;
+ERROR: table "耵蓱悁辨橫" does not exist
+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 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅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葞 | | 8
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 7
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 8
+(3 rows)
+
+select *,octet_length(辨橫) from 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅1a塭掘 | octet_length
+------------------+----------+------------+--------------
+ 闡У攪蛤蝶Ы溯檜 | 悁A01葞 | | 16
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 14
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 16
+(3 rows)
+
+select *,position('蛤' in 辨橫) from 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅1a塭掘 | position
+------------------+----------+------------+----------
+ 闡У攪蛤蝶Ы溯檜 | 悁A01葞 | | 4
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 0
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 0
+(3 rows)
+
+select *,substring(辨橫 from 3 for 4) from 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅1a塭掘 | substring
+------------------+----------+------------+-----------
+ 闡У攪蛤蝶Ы溯檜 | 悁A01葞 | | 攪蛤蝶Ы
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 攪斜楚а
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 攪Щ煎斜
+(3 rows)
+
diff --git a/src/test/mb/expected/euc_tw.out b/src/test/mb/expected/euc_tw.out
new file mode 100644
index 0000000..99eb488
--- /dev/null
+++ b/src/test/mb/expected/euc_tw.out
@@ -0,0 +1,85 @@
+drop table 徻椓罶涷;
+ERROR: table "徻椓罶涷" does not exist
+create table 徻椓罶涷 (諙づ text, 襬く剉韝 varchar, щ彴 varchar(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 徻椓罶涷;
+ 諙づ | 襬く剉韝 | щ彴
+--------+------------------+---------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩
+ 蕍楸鞄 | 娷鳲植鄸く | 斕B10斕
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻
+(3 rows)
+
+select * from 徻椓罶涷 where щ彴 = '崼Z01藻';
+ 諙づ | 襬く剉韝 | щ彴
+--------+------------------+---------
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻
+(1 row)
+
+select * from 徻椓罶涷 where щ彴 ~* '崼z01藻';
+ 諙づ | 襬く剉韝 | щ彴
+--------+------------------+---------
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻
+(1 row)
+
+select * from 徻椓罶涷 where щ彴 like '_Z01_';
+ 諙づ | 襬く剉韝 | щ彴
+--------+------------------+---------
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻
+(1 row)
+
+select * from 徻椓罶涷 where щ彴 like '_Z%';
+ 諙づ | 襬く剉韝 | щ彴
+--------+------------------+---------
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻
+(1 row)
+
+select * from 徻椓罶涷 where 襬く剉韝 ~ '蝞蝞秠[溈奡岍]';
+ 諙づ | 襬く剉韝 | щ彴
+--------+----------+---------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩
+(1 row)
+
+select * from 徻椓罶涷 where 襬く剉韝 ~* '蝞蝞秠[溈奡岍]';
+ 諙づ | 襬く剉韝 | щ彴
+--------+----------+---------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩
+(1 row)
+
+select *, character_length(諙づ) from 徻椓罶涷;
+ 諙づ | 襬く剉韝 | щ彴 | character_length
+--------+------------------+---------+------------------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩 | 3
+ 蕍楸鞄 | 娷鳲植鄸く | 斕B10斕 | 3
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻 | 3
+(3 rows)
+
+select *, octet_length(諙づ) from 徻椓罶涷;
+ 諙づ | 襬く剉韝 | щ彴 | octet_length
+--------+------------------+---------+--------------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩 | 6
+ 蕍楸鞄 | 娷鳲植鄸く | 斕B10斕 | 6
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻 | 6
+(3 rows)
+
+select *, position('植' in 襬く剉韝) from 徻椓罶涷;
+ 諙づ | 襬く剉韝 | щ彴 | position
+--------+------------------+---------+----------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩 | 0
+ 蕍楸鞄 | 娷鳲植鄸く | 斕B10斕 | 3
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻 | 5
+(3 rows)
+
+select *, substring(襬く剉韝 from 3 for 6 ) from 徻椓罶涷;
+ 諙づ | 襬く剉韝 | щ彴 | substring
+--------+------------------+---------+--------------
+ 諔瑼鞄 | 蝞蝞秠岍 | ヾA01癩 | 秠岍
+ 蕍楸鞄 | 娷鳲植鄸く | 斕B10斕 | 植鄸く
+ 顜聜鞄 | 荂抸炴Л植鄸く | 崼Z01藻 | 炴Л植鄸く
+(3 rows)
+
diff --git a/src/test/mb/expected/gb18030.out b/src/test/mb/expected/gb18030.out
new file mode 100644
index 0000000..b14234d
--- /dev/null
+++ b/src/test/mb/expected/gb18030.out
@@ -0,0 +1,86 @@
+drop table 呾C蚚惤;
+create table 呾C蚚惤 (蚚惤 text, 煦戊奈玉 varchar, 靽1A分方 char(16));
+create index 呾C蚚惤index1 on 呾C蚚惤 using btree (蚚惤);
+create index 呾C蚚惤index2 on 呾C蚚惤 using hash (煦戊奈玉);
+insert into 呾C蚚惤 values('戊件疋亙奈正犯奴旦皿伊奶','CA01奻');
+insert into 呾C蚚惤 values('戊件疋亙奈正弘仿白奴永弁旦','煦B10笢');
+insert into 呾C蚚惤 values('戊件疋亙奈正皿伕弘仿穴奈','汳01狟');
+vacuum 呾C蚚惤;
+select * from 呾C蚚惤;
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+----------------------------+------------+------------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 |
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 |
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 |
+(3 rows)
+
+select * from 呾C蚚惤 where 煦戊奈玉 = '汳01狟';
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+--------------------------+------------+------------
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 |
+(1 row)
+
+select * from 呾C蚚惤 where 煦戊奈玉 ~* '芏01狟';
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+--------------------------+------------+------------
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 |
+(1 row)
+
+select * from 呾C蚚惤 where 煦戊奈玉 like '_Z01_';
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+--------------------------+------------+------------
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 |
+(1 row)
+
+select * from 呾C蚚惤 where 煦戊奈玉 like '_Z%';
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+--------------------------+------------+------------
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 |
+(1 row)
+
+select * from 呾C蚚惤 where 蚚惤 ~ '戊件疋亙奈正[犯弘]';
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+----------------------------+------------+------------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 |
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 |
+(2 rows)
+
+select * from 呾C蚚惤 where 蚚惤 ~* '戊件疋亙奈正[犯弘]';
+ 蚚惤 | 煦戊奈玉 | 靽1a分方
+----------------------------+------------+------------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 |
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 |
+(2 rows)
+
+select *,character_length(蚚惤) from 呾C蚚惤;
+ 蚚惤 | 煦戊奈玉 | 靽1a分方 | character_length
+----------------------------+------------+------------+------------------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 | | 12
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 | | 13
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 | | 12
+(3 rows)
+
+select *,octet_length(蚚惤) from 呾C蚚惤;
+ 蚚惤 | 煦戊奈玉 | 靽1a分方 | octet_length
+----------------------------+------------+------------+--------------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 | | 36
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 | | 39
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 | | 36
+(3 rows)
+
+select *,position('犯' in 蚚惤) from 呾C蚚惤;
+ 蚚惤 | 煦戊奈玉 | 靽1a分方 | position
+----------------------------+------------+------------+----------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 | | 7
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 | | 0
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 | | 0
+(3 rows)
+
+select *,substring(蚚惤 from 10 for 4) from 呾C蚚惤;
+ 蚚惤 | 煦戊奈玉 | 靽1a分方 | substring
+----------------------------+------------+------------+-----------
+ 戊件疋亙奈正犯奴旦皿伊奶 | CA01奻 | | 皿伊奶
+ 戊件疋亙奈正弘仿白奴永弁旦 | 煦B10笢 | | 奴永弁旦
+ 戊件疋亙奈正皿伕弘仿穴奈 | 汳01狟 | | 仿穴奈
+(3 rows)
+
diff --git a/src/test/mb/expected/mule_internal.out b/src/test/mb/expected/mule_internal.out
new file mode 100644
index 0000000..ac8b57d
--- /dev/null
+++ b/src/test/mb/expected/mule_internal.out
@@ -0,0 +1,333 @@
+drop table 煌遙窗迕賄;
+ERROR: table "煌遙窗迕賄" does not exist
+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 煌遙窗迕賄;
+ 迕賄 | 坌挀戊□玉 | 嗶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)
+
+drop table 數呾儂扲逄;
+ERROR: table "數呾儂扲逄" does not exist
+create table 數呾儂扲逄(扲逄 text, 煦濬瘍 varchar, 掘蛁1A char(16));
+create index 數呾儂扲逄index1 on 數呾儂扲逄 using btree(扲逄);
+create index 數呾儂扲逄index2 on 數呾儂扲逄 using btree(煦濬瘍);
+insert into 數呾儂扲逄 values('萇齟珆尨そ','儂A01奻');
+insert into 數呾儂扲逄 values('萇齟芞倛','煦B01笢');
+insert into 數呾儂扲逄 values('萇齟最唗埜','汳01狟');
+vacuum 數呾儂扲逄;
+select * from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟珆尨そ | 儂A01奻 |
+ 萇齟芞倛 | 煦B01笢 |
+ 萇齟最唗埜 | 汳01狟 |
+(3 rows)
+
+select * from 數呾儂扲逄 where 煦濬瘍 = '汳01狟';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 煦濬瘍 ~* '芏01狟';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 煦濬瘍 like '_Z01_';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 煦濬瘍 like '_Z%';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟最唗埜 | 汳01狟 |
+(1 row)
+
+select * from 數呾儂扲逄 where 扲逄 ~ '萇齟[珆芞]';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟珆尨そ | 儂A01奻 |
+ 萇齟芞倛 | 煦B01笢 |
+(2 rows)
+
+select * from 數呾儂扲逄 where 扲逄 ~* '萇齟[珆芞]';
+ 扲逄 | 煦濬瘍 | 掘蛁1a
+------------+---------+--------
+ 萇齟珆尨そ | 儂A01奻 |
+ 萇齟芞倛 | 煦B01笢 |
+(2 rows)
+
+select *,character_length(扲逄) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | character_length
+------------+---------+--------+------------------
+ 萇齟珆尨そ | 儂A01奻 | | 5
+ 萇齟芞倛 | 煦B01笢 | | 4
+ 萇齟最唗埜 | 汳01狟 | | 5
+(3 rows)
+
+select *,octet_length(扲逄) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | octet_length
+------------+---------+--------+--------------
+ 萇齟珆尨そ | 儂A01奻 | | 15
+ 萇齟芞倛 | 煦B01笢 | | 12
+ 萇齟最唗埜 | 汳01狟 | | 15
+(3 rows)
+
+select *,position('珆' in 扲逄) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | position
+------------+---------+--------+----------
+ 萇齟珆尨そ | 儂A01奻 | | 3
+ 萇齟芞倛 | 煦B01笢 | | 0
+ 萇齟最唗埜 | 汳01狟 | | 0
+(3 rows)
+
+select *,substring(扲逄 from 3 for 4) from 數呾儂扲逄;
+ 扲逄 | 煦濬瘍 | 掘蛁1a | substring
+------------+---------+--------+-----------
+ 萇齟珆尨そ | 儂A01奻 | | 珆尨そ
+ 萇齟芞倛 | 煦B01笢 | | 芞倛
+ 萇齟最唗埜 | 汳01狟 | | 最唗埜
+(3 rows)
+
+drop table 耵蓱悁辨橫;
+ERROR: table "耵蓱悁辨橫" does not exist
+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 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅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葞 | | 8
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 7
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 8
+(3 rows)
+
+select *,octet_length(辨橫) from 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅1a塭掘 | octet_length
+------------------+----------+------------+--------------
+ 闡У攪蛤蝶Ы溯檜 | 悁A01葞 | | 24
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 21
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 24
+(3 rows)
+
+select *,position('蛤' in 辨橫) from 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅1a塭掘 | position
+------------------+----------+------------+----------
+ 闡У攪蛤蝶Ы溯檜 | 悁A01葞 | | 4
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 0
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 0
+(3 rows)
+
+select *,substring(辨橫 from 3 for 4) from 耵蓱悁辨橫;
+ 辨橫 | 暐袛囀萄 | 綠堅1a塭掘 | substring
+------------------+----------+------------+-----------
+ 闡У攪蛤蝶Ы溯檜 | 悁A01葞 | | 攪蛤蝶Ы
+ 闡У攪斜楚а蝶 | 暐B10齌 | | 攪斜楚а
+ 闡У攪Щ煎斜楚該 | 嬣Z01欞 | | 攪Щ煎斜
+(3 rows)
+
+drop table test;
+ERROR: table "test" does not exist
+create table test (t text);
+insert into test values('ENGLISH');
+insert into test values('FRANォIS');
+insert into test values('ESPA埆L');
+insert into test values('炓LENSKA');
+insert into test values('ENGLISH FRANォIS ESPA埆L 炓LENSKA');
+vacuum test;
+select * from test;
+ t
+-----------------------------------
+ ENGLISH
+ FRANォIS
+ ESPA埆L
+ 炓LENSKA
+ ENGLISH FRANォIS ESPA埆L 炓LENSKA
+(5 rows)
+
+select * from test where t = 'ESPA埆L';
+ t
+---------
+ ESPA埆L
+(1 row)
+
+select * from test where t ~* 'espa峱l';
+ t
+-----------------------------------
+ ESPA埆L
+ ENGLISH FRANォIS ESPA埆L 炓LENSKA
+(2 rows)
+
+select *,character_length(t) from test;
+ t | character_length
+-----------------------------------+------------------
+ ENGLISH | 7
+ FRANォIS | 8
+ ESPA埆L | 7
+ 炓LENSKA | 8
+ ENGLISH FRANォIS ESPA埆L 炓LENSKA | 33
+(5 rows)
+
+select *,octet_length(t) from test;
+ t | octet_length
+-----------------------------------+--------------
+ ENGLISH | 7
+ FRANォIS | 9
+ ESPA埆L | 8
+ 炓LENSKA | 9
+ ENGLISH FRANォIS ESPA埆L 炓LENSKA | 36
+(5 rows)
+
+select *,position('L' in t) from test;
+ t | position
+-----------------------------------+----------
+ ENGLISH | 4
+ FRANォIS | 0
+ ESPA埆L | 7
+ 炓LENSKA | 3
+ ENGLISH FRANォIS ESPA埆L 炓LENSKA | 4
+(5 rows)
+
+select *,substring(t from 3 for 4) from test;
+ t | substring
+-----------------------------------+-----------
+ ENGLISH | GLIS
+ FRANォIS | ANォ
+ ESPA埆L | PA埆
+ 炓LENSKA | LENS
+ ENGLISH FRANォIS ESPA埆L 炓LENSKA | GLIS
+(5 rows)
+
diff --git a/src/test/mb/expected/sjis.out b/src/test/mb/expected/sjis.out
new file mode 100644
index 0000000..db2bfd0
--- /dev/null
+++ b/src/test/mb/expected/sjis.out
@@ -0,0 +1,90 @@
+drop table vZ@p;
+create table vZ@p (p text, R[h varchar, l1A char(16));
+create index vZ@p甋ndex1 on vZ@p using btree (p);
+create index vZ@p甋ndex2 on vZ@p using hash (R[h);
+insert into vZ@p values('Rs[^fBXvC','@A01');
+insert into vZ@p values('Rs[^OtBbNX','朋10');
+insert into vZ@p values('Rs[^vO}[','lZ01');
+vacuum vZ@p;
+select * from vZ@p;
+ p | R[h | l1a
+----------------------------+------------+------------
+ Rs[^fBXvC | @A01 |
+ Rs[^OtBbNX | 朋10 |
+ Rs[^vO}[ | lZ01 |
+(3 rows)
+
+select * from vZ@p where R[h = 'lZ01';
+ p | R[h | l1a
+--------------------------+------------+------------
+ Rs[^vO}[ | lZ01 |
+(1 row)
+
+select * from vZ@p where R[h ~* 'lz01';
+ p | R[h | l1a
+--------------------------+------------+------------
+ Rs[^vO}[ | lZ01 |
+(1 row)
+
+select * from vZ@p where R[h like '_Z01_';
+ p | R[h | l1a
+--------------------------+------------+------------
+ Rs[^vO}[ | lZ01 |
+(1 row)
+
+select * from vZ@p where R[h like '_Z%';
+ p | R[h | l1a
+--------------------------+------------+------------
+ Rs[^vO}[ | lZ01 |
+(1 row)
+
+select * from vZ@p where p ~ 'Rs[^[fO]';
+ p | R[h | l1a
+----------------------------+------------+------------
+ Rs[^fBXvC | @A01 |
+ Rs[^OtBbNX | 朋10 |
+(2 rows)
+
+select * from vZ@p where p ~* 'Rs[^[fO]';
+ p | R[h | l1a
+----------------------------+------------+------------
+ Rs[^fBXvC | @A01 |
+ Rs[^OtBbNX | 朋10 |
+(2 rows)
+
+select *,character_length(p) from vZ@p;
+ p | R[h | l1a | character_length
+----------------------------+------------+------------+------------------
+ Rs[^fBXvC | @A01 | | 12
+ Rs[^OtBbNX | 朋10 | | 13
+ Rs[^vO}[ | lZ01 | | 12
+(3 rows)
+
+select *,octet_length(p) from vZ@p;
+ p | R[h | l1a | octet_length
+----------------------------+------------+------------+--------------
+ Rs[^fBXvC | @A01 | | 24
+ Rs[^OtBbNX | 朋10 | | 26
+ Rs[^vO}[ | lZ01 | | 24
+(3 rows)
+
+select *,position('f' in p) from vZ@p;
+ p | R[h | l1a | position
+----------------------------+------------+------------+----------
+ Rs[^fBXvC | @A01 | | 7
+ Rs[^OtBbNX | 朋10 | | 0
+ Rs[^vO}[ | lZ01 | | 0
+(3 rows)
+
+select *,substring(p from 10 for 4) from vZ@p;
+ p | R[h | l1a | substring
+----------------------------+------------+------------+-----------
+ Rs[^fBXvC | @A01 | | vC
+ Rs[^OtBbNX | 朋10 | | BbNX
+ Rs[^vO}[ | lZ01 | | }[
+(3 rows)
+
+copy vZ@p to stdout;
+Rs[^fBXvC @A01 \N
+Rs[^OtBbNX 朋10 \N
+Rs[^vO}[ lZ01 \N
diff --git a/src/test/mb/expected/utf8.out b/src/test/mb/expected/utf8.out
new file mode 100644
index 0000000..8f9f63c
--- /dev/null
+++ b/src/test/mb/expected/utf8.out
@@ -0,0 +1,87 @@
+drop table 閮蝞璈刻;
+ERROR: table "閮蝞璈刻" does not exist
+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('喋喋乓潦踴准啜押','鈭暢01銝');
+vacuum 閮蝞璈刻;
+select * from 閮蝞璈刻;
+ 刻 | 憿喋潦 | 1a
+----------------------------+------------+------------
+ 喋喋乓潦踴嫘研 | 璈A01銝 |
+ 喋喋乓潦踴啜押胯 | B10銝 |
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 |
+(3 rows)
+
+select * from 閮蝞璈刻 where 憿喋潦 = '鈭暢01銝';
+ 刻 | 憿喋潦 | 1a
+--------------------------+------------+------------
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 |
+(1 row)
+
+select * from 閮蝞璈刻 where 憿喋潦 ~* '鈭漠01銝';
+ 刻 | 憿喋潦 | 1a
+--------------------------+------------+------------
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 |
+(1 row)
+
+select * from 閮蝞璈刻 where 憿喋潦 like '_Z01_';
+ 刻 | 憿喋潦 | 1a
+--------------------------+------------+------------
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 |
+(1 row)
+
+select * from 閮蝞璈刻 where 憿喋潦 like '_Z%';
+ 刻 | 憿喋潦 | 1a
+--------------------------+------------+------------
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 |
+(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
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 | | 12
+(3 rows)
+
+select *,octet_length(刻) from 閮蝞璈刻;
+ 刻 | 憿喋潦 | 1a | octet_length
+----------------------------+------------+------------+--------------
+ 喋喋乓潦踴嫘研 | 璈A01銝 | | 36
+ 喋喋乓潦踴啜押胯 | B10銝 | | 39
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 | | 36
+(3 rows)
+
+select *,position('' in 刻) from 閮蝞璈刻;
+ 刻 | 憿喋潦 | 1a | position
+----------------------------+------------+------------+----------
+ 喋喋乓潦踴嫘研 | 璈A01銝 | | 7
+ 喋喋乓潦踴啜押胯 | B10銝 | | 0
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 | | 0
+(3 rows)
+
+select *,substring(刻 from 10 for 4) from 閮蝞璈刻;
+ 刻 | 憿喋潦 | 1a | substring
+----------------------------+------------+------------+-----------
+ 喋喋乓潦踴嫘研 | 璈A01銝 | | 研
+ 喋喋乓潦踴啜押胯 | B10銝 | | 胯
+ 喋喋乓潦踴准啜押 | 鈭暢01銝 | | 押
+(3 rows)
+
diff --git a/src/test/mb/mbregress.sh b/src/test/mb/mbregress.sh
new file mode 100755
index 0000000..c313565
--- /dev/null
+++ b/src/test/mb/mbregress.sh
@@ -0,0 +1,74 @@
+#! /bin/sh
+# src/test/mb/mbregress.sh
+
+if echo '\c' | grep -s c >/dev/null 2>&1
+then
+ ECHO_N="echo -n"
+ ECHO_C=""
+else
+ ECHO_N="echo"
+ ECHO_C='\c'
+fi
+
+if [ ! -d results ];then
+ mkdir results
+fi
+
+dropdb --if-exists utf8
+createdb -T template0 -l C -E UTF8 utf8 || exit 1
+
+PSQL="psql -X -n -e -q"
+
+# 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
+for i in $tests
+do
+ $ECHO_N "${i} .. " $ECHO_C
+
+ if [ $i = sjis ];then
+ PGCLIENTENCODING=SJIS
+ export PGCLIENTENCODING
+ $PSQL euc_jp < sql/sjis.sql > results/sjis.out 2>&1
+ unset PGCLIENTENCODING
+ elif [ $i = big5 ];then
+ PGCLIENTENCODING=BIG5
+ 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
+ $PSQL $i < sql/${i}.sql > results/${i}.out 2>&1
+ fi
+
+ if [ -f expected/${i}-${SYSTEM}.out ]
+ then
+ EXPECTED="expected/${i}-${SYSTEM}.out"
+ else
+ EXPECTED="expected/${i}.out"
+ fi
+
+ if [ `diff ${EXPECTED} results/${i}.out | wc -l` -ne 0 ]
+ then
+ ( diff -C3 ${EXPECTED} results/${i}.out; \
+ echo ""; \
+ echo "----------------------"; \
+ echo "" ) >> regression.diffs
+ echo failed
+ EXITCODE=1
+ else
+ echo ok
+ fi
+done
+
+exit $EXITCODE
diff --git a/src/test/mb/sql/big5.sql b/src/test/mb/sql/big5.sql
new file mode 100644
index 0000000..4e2d100
--- /dev/null
+++ b/src/test/mb/sql/big5.sql
@@ -0,0 +1,20 @@
+drop table 廠商資料;
+create table 廠商資料 (行業別 text, 公司抬頭 varchar, 地址 varchar(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 3 for 6 ) from 廠商資料;
diff --git a/src/test/mb/sql/euc_cn.sql b/src/test/mb/sql/euc_cn.sql
new file mode 100644
index 0000000..7cd0b9b
--- /dev/null
+++ b/src/test/mb/sql/euc_cn.sql
@@ -0,0 +1,19 @@
+drop table 數呾儂扲逄;
+create table 數呾儂扲逄(扲逄 text, 煦濬瘍 varchar, 掘蛁1A char(16));
+create index 數呾儂扲逄index1 on 數呾儂扲逄 using btree(扲逄);
+create index 數呾儂扲逄index2 on 數呾儂扲逄 using btree(煦濬瘍);
+insert into 數呾儂扲逄 values('萇齟珆尨そ','儂A01奻');
+insert into 數呾儂扲逄 values('萇齟芞倛','煦B01笢');
+insert into 數呾儂扲逄 values('萇齟最唗埜','汳01狟');
+vacuum 數呾儂扲逄;
+select * from 數呾儂扲逄;
+select * from 數呾儂扲逄 where 煦濬瘍 = '汳01狟';
+select * from 數呾儂扲逄 where 煦濬瘍 ~* '芏01狟';
+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 3 for 4) from 數呾儂扲逄;
diff --git a/src/test/mb/sql/euc_jp.sql b/src/test/mb/sql/euc_jp.sql
new file mode 100644
index 0000000..2021205
--- /dev/null
+++ b/src/test/mb/sql/euc_jp.sql
@@ -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 煌遙窗迕賄;
diff --git a/src/test/mb/sql/euc_kr.sql b/src/test/mb/sql/euc_kr.sql
new file mode 100644
index 0000000..cf9e07f
--- /dev/null
+++ b/src/test/mb/sql/euc_kr.sql
@@ -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 3 for 4) from 耵蓱悁辨橫;
diff --git a/src/test/mb/sql/euc_tw.sql b/src/test/mb/sql/euc_tw.sql
new file mode 100644
index 0000000..79f3def
--- /dev/null
+++ b/src/test/mb/sql/euc_tw.sql
@@ -0,0 +1,20 @@
+drop table 徻椓罶涷;
+create table 徻椓罶涷 (諙づ text, 襬く剉韝 varchar, щ彴 varchar(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 3 for 6 ) from 徻椓罶涷;
diff --git a/src/test/mb/sql/gb18030.sql b/src/test/mb/sql/gb18030.sql
new file mode 100644
index 0000000..91ecaaa
--- /dev/null
+++ b/src/test/mb/sql/gb18030.sql
@@ -0,0 +1,19 @@
+drop table 呾C蚚惤;
+create table 呾C蚚惤 (蚚惤 text, 煦戊奈玉 varchar, 靽1A分方 char(16));
+create index 呾C蚚惤index1 on 呾C蚚惤 using btree (蚚惤);
+create index 呾C蚚惤index2 on 呾C蚚惤 using hash (煦戊奈玉);
+insert into 呾C蚚惤 values('戊件疋亙奈正犯奴旦皿伊奶','CA01奻');
+insert into 呾C蚚惤 values('戊件疋亙奈正弘仿白奴永弁旦','煦B10笢');
+insert into 呾C蚚惤 values('戊件疋亙奈正皿伕弘仿穴奈','汳01狟');
+vacuum 呾C蚚惤;
+select * from 呾C蚚惤;
+select * from 呾C蚚惤 where 煦戊奈玉 = '汳01狟';
+select * from 呾C蚚惤 where 煦戊奈玉 ~* '芏01狟';
+select * from 呾C蚚惤 where 煦戊奈玉 like '_Z01_';
+select * from 呾C蚚惤 where 煦戊奈玉 like '_Z%';
+select * from 呾C蚚惤 where 蚚惤 ~ '戊件疋亙奈正[犯弘]';
+select * from 呾C蚚惤 where 蚚惤 ~* '戊件疋亙奈正[犯弘]';
+select *,character_length(蚚惤) from 呾C蚚惤;
+select *,octet_length(蚚惤) from 呾C蚚惤;
+select *,position('犯' in 蚚惤) from 呾C蚚惤;
+select *,substring(蚚惤 from 10 for 4) from 呾C蚚惤;
diff --git a/src/test/mb/sql/mule_internal.sql b/src/test/mb/sql/mule_internal.sql
new file mode 100644
index 0000000..2e381f0
--- /dev/null
+++ b/src/test/mb/sql/mule_internal.sql
@@ -0,0 +1,72 @@
+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 煌遙窗迕賄;
+drop table 數呾儂扲逄;
+create table 數呾儂扲逄(扲逄 text, 煦濬瘍 varchar, 掘蛁1A char(16));
+create index 數呾儂扲逄index1 on 數呾儂扲逄 using btree(扲逄);
+create index 數呾儂扲逄index2 on 數呾儂扲逄 using btree(煦濬瘍);
+insert into 數呾儂扲逄 values('萇齟珆尨そ','儂A01奻');
+insert into 數呾儂扲逄 values('萇齟芞倛','煦B01笢');
+insert into 數呾儂扲逄 values('萇齟最唗埜','汳01狟');
+vacuum 數呾儂扲逄;
+select * from 數呾儂扲逄;
+select * from 數呾儂扲逄 where 煦濬瘍 = '汳01狟';
+select * from 數呾儂扲逄 where 煦濬瘍 ~* '芏01狟';
+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 3 for 4) from 數呾儂扲逄;
+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 3 for 4) from 耵蓱悁辨橫;
+drop table test;
+create table test (t text);
+insert into test values('ENGLISH');
+insert into test values('FRANォIS');
+insert into test values('ESPA埆L');
+insert into test values('炓LENSKA');
+insert into test values('ENGLISH FRANォIS ESPA埆L 炓LENSKA');
+vacuum test;
+select * from test;
+select * from test where t = 'ESPA埆L';
+select * from test where t ~* 'espa峱l';
+select *,character_length(t) from test;
+select *,octet_length(t) from test;
+select *,position('L' in t) from test;
+select *,substring(t from 3 for 4) from test;
diff --git a/src/test/mb/sql/sjis.sql b/src/test/mb/sql/sjis.sql
new file mode 100644
index 0000000..dfa66fc
--- /dev/null
+++ b/src/test/mb/sql/sjis.sql
@@ -0,0 +1,20 @@
+drop table vZ@p;
+create table vZ@p (p text, R[h varchar, l1A char(16));
+create index vZ@p甋ndex1 on vZ@p using btree (p);
+create index vZ@p甋ndex2 on vZ@p using hash (R[h);
+insert into vZ@p values('Rs[^fBXvC','@A01');
+insert into vZ@p values('Rs[^OtBbNX','朋10');
+insert into vZ@p values('Rs[^vO}[','lZ01');
+vacuum vZ@p;
+select * from vZ@p;
+select * from vZ@p where R[h = 'lZ01';
+select * from vZ@p where R[h ~* 'lz01';
+select * from vZ@p where R[h like '_Z01_';
+select * from vZ@p where R[h like '_Z%';
+select * from vZ@p where p ~ 'Rs[^[fO]';
+select * from vZ@p where p ~* 'Rs[^[fO]';
+select *,character_length(p) from vZ@p;
+select *,octet_length(p) from vZ@p;
+select *,position('f' in p) from vZ@p;
+select *,substring(p from 10 for 4) from vZ@p;
+copy vZ@p to stdout;
diff --git a/src/test/mb/sql/utf8.sql b/src/test/mb/sql/utf8.sql
new file mode 100644
index 0000000..e722d3d
--- /dev/null
+++ b/src/test/mb/sql/utf8.sql
@@ -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('喋喋乓潦踴准啜押','鈭暢01銝');
+vacuum 閮蝞璈刻;
+select * from 閮蝞璈刻;
+select * from 閮蝞璈刻 where 憿喋潦 = '鈭暢01銝';
+select * from 閮蝞璈刻 where 憿喋潦 ~* '鈭漠01銝';
+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 閮蝞璈刻;