Solution of the file name problem of copy on windows. - Mailing list pgsql-hackers

From Hiroshi Saito
Subject Solution of the file name problem of copy on windows.
Date
Msg-id C96B1306C7B243E9BFDFE88F8DB405C6@HIRO57887DE653
Whole thread Raw
Responses Re: Solution of the file name problem of copy on windows.  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Solution of the file name problem of copy on windows.  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
List pgsql-hackers
Hi Tom-san.

I want to solve one problem before the release of 8.4.
However, since it also seems to be the new feature,
if not enough for 8.4, you may suggest that it is 8.5.

In Japan, the local file name of a server is dealt with by SJIS.
The example present Postgres...

server_encoding = UTF-8
client_encoding = SJIS

At this time, a copy file name is UTF-8.  It was troubled by handling.:-(
Then,  I make this proposal patch.

regression test

=======================
 All 120 tests passed.
=======================

as for database is UTF-8.

HIROSHI=# \l
                                 データベース一覧
   名前    | 所有者  | エンコーディング | Collation | Ctype |     アクセス権

-----------+---------+------------------+-----------+-------+-------------------
--
 HIROSHI   | HIROSHI | UTF8             | C         | C     |
 eucdb     | HIROSHI | EUC_JP           | C         | C     |

HIROSHI=# create table 日本語てすと (きー text);
CREATE TABLE
HIROSHI=# insert into 日本語てすと values('わーい');
INSERT 0 1
HIROSHI=# copy 日本語てすと to 'C:/tmp/日本語UTF8.txt';
COPY 1
HIROSHI=# delete from 日本語てすと;
DELETE 1
HIROSHI=# copy 日本語てすと from 'C:/tmp/日本語UTF8.txt';
COPY 1
HIROSHI=# select * from 日本語てすと;
  きー
--------
 わーい
(1 行)

as for database is eucjp.

HIROSHI=# \c eucdb
psql (8.4devel)
データベース "eucdb" に接続しました。.
eucdb=# \d
            リレーションの一覧
 スキーマ |     名前     |  型   | 所有者
----------+--------------+-------+---------
 public   | 日本語てすと | table | HIROSHI
(1 行)

eucdb=# select * from 日本語てすと;
  きー
--------
 わーい
(1 行)

eucdb=# copy 日本語てすと to 'C:/tmp/日本語eucdb.txt';
COPY 1
eucdb=# delete from 日本語てすと;
DELETE 1
eucdb=# copy 日本語てすと from 'C:/tmp/日本語eucdb.txt';
COPY 1
eucdb=# select * from 日本語てすと;
  きー
--------
 わーい
(1 行)


C:\tmp>dir 日本語*
 ドライブ C のボリューム ラベルは SYS です
 ボリューム シリアル番号は 1433-2C7C です

 C:\tmp のディレクトリ

2009/04/07  13:58                 8 日本語eucdb.txt
2009/04/07  13:58                 8 日本語utf8.txt
               2 個のファイル                  16 バイト


It seems that it is very comfortable. !!
What do you think?

Regards,
Hiroshi Saito

Attachment

pgsql-hackers by date:

Previous
From: Sam Mason
Date:
Subject: NaN support in NUMERIC data type
Next
From: Tom Lane
Date:
Subject: Re: NaN support in NUMERIC data type