postgresql/src/test/mb/sql/mule_internal.sql
Marc G. Fournier bf00bbb0c4 I really hope that I haven't missed anything in this one...
From: t-ishii@sra.co.jp

Attached are patches to enhance the multi-byte support.  (patches are
against 7/18 snapshot)

* determine encoding at initdb/createdb rather than compile time

Now initdb/createdb has an option to specify the encoding. Also, I
modified the syntax of CREATE DATABASE to accept encoding option. See
README.mb for more details.

For this purpose I have added new column "encoding" to pg_database.
Also pg_attribute and pg_class are changed to catch up the
modification to pg_database.  Actually I haved added pg_database_mb.h,
pg_attribute_mb.h and pg_class_mb.h. These are used only when MB is
enabled. The reason having separate files is I couldn't find a way to
use ifdef or whatever in those files. I have to admit it looks
ugly. No way.

* support for PGCLIENTENCODING when issuing COPY command

commands/copy.c modified.

* support for SQL92 syntax "SET NAMES"

See gram.y.

* support for LATIN2-5
* add UNICODE regression test case
* new test suite for MB

New directory test/mb added.

* clean up source files

Basic idea is to have MB's own subdirectory for easier maintenance.
These are include/mb and backend/utils/mb.
1998-07-24 03:32:46 +00:00

72 lines
4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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('‘µç‘ÄÔ‘³Ì‘Ðò‘Ô±','ÈË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 ͪߩѦ¿ë¾î;
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<EFBFBD>ÇAIS');
insert into test values('ESPA<EFBFBD>ÑOL');
insert into test values('<EFBFBD>ÍSLENSKA');
insert into test values('ENGLISH FRAN<41>ÇAIS ESPA<50>ÑOL <20>ÍSLENSKA');
vacuum test;
select * from test;
select * from test where t = 'ESPA<EFBFBD>ÑOL';
select * from test where t ~* 'espa<EFBFBD>Ñol';
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;