BUG #4987: registered in pg_type by a wrong table name - Mailing list pgsql-bugs
From | durfenlee |
---|---|
Subject | BUG #4987: registered in pg_type by a wrong table name |
Date | |
Msg-id | 200908151733.n7FHX1sH000569@wwwmaster.postgresql.org Whole thread Raw |
Responses |
Re: BUG #4987: registered in pg_type by a wrong table name
|
List | pgsql-bugs |
The following bug has been logged online: Bug reference: 4987 Logged by: durfenlee Email address: durfenlee@gmail.com PostgreSQL version: 8.4.0 Operating system: Windows XP Professional(32bit) Description: registered in pg_type by a wrong table name Details: Hi, My name is durfenlee. I found bug to postgresql8.4.0 When create table by long table name(63byte just) and last charcter is multi-byte charcter, It is registered in pg_type by a wrong table name. At this time, it becomes an encoding error when the encoding of the database and the client is different. (There is an influence in processing that uses pg_type. like a pg_dump. ) [My Environment] OS : Windows XP Professional(32bit) PostgreSQL : "PostgreSQL 8.4.0, compiled by Visual C++ build 1400, 32-bit" Database Encording : UTF8 Client Encording : SJIS /*************************************************************************** ****************** * 1. long table name's(63 byte just) last charcter is not muli-byte charcter **************************************************************************** ******************/ [run psql] =============================== postgres=# select typname from pg_type where typname like '%abcdefghi%'; typname --------- (0 row) postgres=# create table abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_123(test int); CREATE TABLE postgres=# select typname from pg_type where typname like '%abcdefghi%'; typname ----------------------------------------------------------------- abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_123 _abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_12 (2 row) postgres=# =============================== when create table,2 recorde registered in pg_type(table type and enum type?). if table names is 63byte, enum typname names is named by the following rules. - "_" is applied first. - The last 1 byte is cut down. /*************************************************************************** ************** * 2. long table name's (63 byte just) last charcter is muli-byte charcter **************************************************************************** **************/ [run psql] =============================== postgres=# create table abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_ã(test int); //(last charcter is JAPANESE HIRAGANA. UTF8 code is "0xE38182") CREATE TABLE postgres=# \encoding UTF8 postgres=# select typname from pg_type where typname like '%abcdefghi%'; typname ---------------------------------------------------------------- abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_縺㻠_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_ (2 row) postgres=# \encoding SJIS postgres=# \encoding SJIS postgres=# select typname from pg_type where typname like '%abcdefghi%'; ERROR: invalid byte sequence for encoding "UTF8": 0xe381 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". =============================== For last charcter is multi-byte, It fails in encording if 1 byte is cut down only. Thanks!!
pgsql-bugs by date: