pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: koichi.dbms@gmail.com
Subject: BUG #18735: Specific multibyte character in psql file path command parameter for Windows
Date: Thu, 05 Dec 2024 02:25:37 +0000
Message-ID: <18735-4acdb3998bb9f2b1@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18735
Logged by:          Koichi Suzuki
Email address:      koichi.dbms@gmail.com
PostgreSQL version: 17.2
Operating system:   Windows 10, Japanese language version
Description:        

In psql for Windows 10, version 17.2, some multibyte character in the file
path of psql command causes error such as:
=======
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Client Encoding [SJIS]:
ユーザー postgres のパスワード:
psql (17.2)
"help"でヘルプを表示します。

postgres=# \cd 'c:/work/09_環境構築'
postgres=# \o 'c:/work/09_環境構築/work.out'
postgres=# select * from pg_database;
postgres=# \o
postgres=# \! type c:\work\09_環境構築\work.out
 oid |  datname  | datdba | encoding | datlocprovider | datistemplate |
datallowconn | dathasloginevt | datconnlimit | datfrozenxid | datminmxid |
dattablespace |     datcollate     |      datctype      | datlocale |
daticurules | datcollversion |               datacl
-----+-----------+--------+----------+----------------+---------------+--------------+----------------+--------------+--------------+------------+---------------+--------------------+--------------------+-----------+-------------+----------------+-------------------------------------
   5 | postgres  |     10 |        6 | c              | f             | t   
        | f              |           -1 |          731 |          1 |       
  1663 | Japanese_Japan.932 | Japanese_Japan.932 |           |             |
               |
   1 | template1 |     10 |        6 | c              | t             | t   
        | f              |           -1 |          731 |          1 |       
  1663 | Japanese_Japan.932 | Japanese_Japan.932 |           |             |
               | {=c/postgres,postgres=CTc/postgres}
   4 | template0 |     10 |        6 | c              | t             | f   
        | f              |           -1 |          731 |          1 |       
  1663 | Japanese_Japan.932 | Japanese_Japan.932 |           |             |
               | {=c/postgres,postgres=CTc/postgres}
(3 行)

postgres=#
postgres=# \i 'c:/work/09_環境構築/sqmple.sql'
c:/work/09_環境穀z/sqmple.sql: No such file or directory
postgres=# copy pg_database to 'c:/work/09_環境構築/database.out'
postgres-# \copy pg_database to 'c:/work/09_環境構築/database.csv' with (format
csv, header)
c:/work/09_環境・築/database.csv: No such file or directory
=====

Analysis:
* Latter byte valueof the character in question is same as '\' (backslash). 
  It looks that this byte value is handled as escape characters.   This
happns SHIFT JIS client encoding.
* The issue happens in \i, \ir and \copy but does not happen in \cd, \o and
\! command.
* The similar issue may happen if the latter byte value of a multibyte
character is same as '/' (directory delimiter).



view thread (24+ messages)  latest in thread

Message-ID: <18735-4acdb3998bb9f2b1@postgresql.org>
Permalink:  ../18735-4acdb3998bb9f2b1@postgresql.org/
Also on:    postgresql.org/message-id/18735-4acdb3998bb9f2b1@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, koichi.dbms@gmail.com
  Subject: Re: BUG #18735: Specific multibyte character in psql file path command parameter for Windows
  In-Reply-To: <18735-4acdb3998bb9f2b1@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox