Solution of the file name problem of copy on windows.

From: "Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Solution of the file name problem of copy on windows.
Date: 2009-04-07 16:40:49
Message-ID: C96B1306C7B243E9BFDFE88F8DB405C6@HIRO57887DE653
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
copy_patch3 application/octet-stream 3.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-04-07 16:51:21 Re: NaN support in NUMERIC data type
Previous Message David E. Wheeler 2009-04-07 16:05:59 Re: [HACKERS] string_to_array with empty input