mirror of
https://github.com/postgres/postgres.git
synced 2025-12-07 12:02:30 +03:00
Commit Patrice's patches except:
> - corrects a bit the UTF-8 code from Tatsuo to allow Unicode 3.1 > characters (characters with values >= 0x10000, which are encoded on > four bytes). Also, update mb/expected/unicode.out. This is necessary since the patches affetc the result of queries using UTF-8. --------------------------------------------------------------- Hi, I should have sent the patch earlier, but got delayed by other stuff. Anyway, here is the patch: - most of the functionality is only activated when MULTIBYTE is defined, - check valid UTF-8 characters, client-side only yet, and only on output, you still can send invalid UTF-8 to the server (so, it's only partly compliant to Unicode 3.1, but that's better than nothing). - formats with the correct number of columns (that's why I made it in the first place after all), but only for UNICODE. However, the code allows to plug-in routines for other encodings, as Tatsuo did for the other multibyte functions. - corrects a bit the UTF-8 code from Tatsuo to allow Unicode 3.1 characters (characters with values >= 0x10000, which are encoded on four bytes). - doesn't depend on the locale capabilities of the glibc (useful for remote telnet). I would like somebody to check it closely, as it is my first patch to pgsql. Also, I created dummy .orig files, so that the two files I created are included, I hope that's the right way. Now, a lot of functionality is NOT included here, but I will keep that for 7.3 :) That includes all string checking on the server side (which will have to be a bit more optimised ;) ), and the input checking on the client side for UTF-8, though that should not be difficult. It's just to send the strings through mbvalidate() before sending them to the server. Strong checking on UTF-8 strings is mandatory to be compliant with Unicode 3.1+ . Do I have time to look for a patch to include iso-8859-15 for 7.2 ? The euro is coming 1. january 2002 (before 7.3 !) and over 280 millions people in Europe will need the euro sign and only iso-8859-15 and iso-8859-16 have it (and unfortunately, I don't think all Unices will switch to Unicode in the meantime).... err... yes, I know that this is not every single person in Europe that uses PostgreSql, so it's not exactly 280m, but it's just a matter of time ! ;) I'll come back (on pgsql-hackers) later to ask a few questions regarding the full unicode support (normalisation, collation, regexes,...) on the server side :) Here is the patch ! Patrice. -- Patrice HÉDÉ ------------------------------- patrice à islande org ----- -- Isn't it weird how scientists can imagine all the matter of the universe exploding out of a dot smaller than the head of a pin, but they can't come up with a more evocative name for it than "The Big Bang" ? -- What would _you_ call the creation of the universe ? -- "The HORRENDOUS SPACE KABLOOIE !" - Calvin and Hobbes ------------------------------------------ http://www.islande.org/ -----
This commit is contained in:
@@ -8,80 +8,80 @@ insert into 計算機用語 values('コンピュータグラフィックス','
|
||||
insert into 計算機用語 values('コンピュータプログラマー','人Z01下');
|
||||
vacuum 計算機用語;
|
||||
select * from 計算機用語;
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
-----------------------------------------+-----------------+----------------
|
||||
コンピュータディスプレイ | 機A01上 |
|
||||
コンピュータグラフィックス | 分B10中 |
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
----------------------------+------------+------------
|
||||
コンピュータディスプレイ | 機A01上 |
|
||||
コンピュータグラフィックス | 分B10中 |
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
(3 rows)
|
||||
|
||||
select * from 計算機用語 where 分類コード = '人Z01下';
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------------------+-----------------+----------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------+------------+------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
(1 row)
|
||||
|
||||
select * from 計算機用語 where 分類コード ~* '人z01下';
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------------------+-----------------+----------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------+------------+------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
(1 row)
|
||||
|
||||
select * from 計算機用語 where 分類コード like '_Z01_';
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------------------+-----------------+----------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------+------------+------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
(1 row)
|
||||
|
||||
select * from 計算機用語 where 分類コード like '_Z%';
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------------------+-----------------+----------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
--------------------------+------------+------------
|
||||
コンピュータプログラマー | 人Z01下 |
|
||||
(1 row)
|
||||
|
||||
select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]';
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
-----------------------------------------+-----------------+----------------
|
||||
コンピュータディスプレイ | 機A01上 |
|
||||
コンピュータグラフィックス | 分B10中 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
----------------------------+------------+------------
|
||||
コンピュータディスプレイ | 機A01上 |
|
||||
コンピュータグラフィックス | 分B10中 |
|
||||
(2 rows)
|
||||
|
||||
select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]';
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
-----------------------------------------+-----------------+----------------
|
||||
コンピュータディスプレイ | 機A01上 |
|
||||
コンピュータグラフィックス | 分B10中 |
|
||||
用語 | 分類コード | 備考1aだよ
|
||||
----------------------------+------------+------------
|
||||
コンピュータディスプレイ | 機A01上 |
|
||||
コンピュータグラフィックス | 分B10中 |
|
||||
(2 rows)
|
||||
|
||||
select *,character_length(用語) from 計算機用語;
|
||||
用語 | 分類コード | 備考1aだよ | char_length
|
||||
-----------------------------------------+-----------------+----------------+-------------
|
||||
コンピュータディスプレイ | 機A01上 | | 12
|
||||
コンピュータグラフィックス | 分B10中 | | 13
|
||||
コンピュータプログラマー | 人Z01下 | | 12
|
||||
用語 | 分類コード | 備考1aだよ | char_length
|
||||
----------------------------+------------+------------+-------------
|
||||
コンピュータディスプレイ | 機A01上 | | 12
|
||||
コンピュータグラフィックス | 分B10中 | | 13
|
||||
コンピュータプログラマー | 人Z01下 | | 12
|
||||
(3 rows)
|
||||
|
||||
select *,octet_length(用語) from 計算機用語;
|
||||
用語 | 分類コード | 備考1aだよ | octet_length
|
||||
-----------------------------------------+-----------------+----------------+--------------
|
||||
コンピュータディスプレイ | 機A01上 | | 36
|
||||
コンピュータグラフィックス | 分B10中 | | 39
|
||||
コンピュータプログラマー | 人Z01下 | | 36
|
||||
用語 | 分類コード | 備考1aだよ | octet_length
|
||||
----------------------------+------------+------------+--------------
|
||||
コンピュータディスプレイ | 機A01上 | | 36
|
||||
コンピュータグラフィックス | 分B10中 | | 39
|
||||
コンピュータプログラマー | 人Z01下 | | 36
|
||||
(3 rows)
|
||||
|
||||
select *,position('デ' in 用語) from 計算機用語;
|
||||
用語 | 分類コード | 備考1aだよ | position
|
||||
-----------------------------------------+-----------------+----------------+----------
|
||||
コンピュータディスプレイ | 機A01上 | | 7
|
||||
コンピュータグラフィックス | 分B10中 | | 0
|
||||
コンピュータプログラマー | 人Z01下 | | 0
|
||||
用語 | 分類コード | 備考1aだよ | position
|
||||
----------------------------+------------+------------+----------
|
||||
コンピュータディスプレイ | 機A01上 | | 7
|
||||
コンピュータグラフィックス | 分B10中 | | 0
|
||||
コンピュータプログラマー | 人Z01下 | | 0
|
||||
(3 rows)
|
||||
|
||||
select *,substring(用語 from 10 for 4) from 計算機用語;
|
||||
用語 | 分類コード | 備考1aだよ | substring
|
||||
-----------------------------------------+-----------------+----------------+--------------
|
||||
コンピュータディスプレイ | 機A01上 | | プレイ
|
||||
コンピュータグラフィックス | 分B10中 | | ィックス
|
||||
コンピュータプログラマー | 人Z01下 | | ラマー
|
||||
用語 | 分類コード | 備考1aだよ | substring
|
||||
----------------------------+------------+------------+-----------
|
||||
コンピュータディスプレイ | 機A01上 | | プレイ
|
||||
コンピュータグラフィックス | 分B10中 | | ィックス
|
||||
コンピュータプログラマー | 人Z01下 | | ラマー
|
||||
(3 rows)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user