From: | 坂本 翼 <sakamoto(dot)tsubasa(at)ryobi(dot)co(dot)jp> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Cc: | <sakamoto(dot)tsubasa(at)ryobi(dot)co(dot)jp> |
Subject: | client encoding that psql command sets |
Date: | 2014-02-06 07:43:33 |
Message-ID: | 004601cf230f$23070d20$69152760$@ryobi.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Hi all,
When I tried to psql command, I found that the result of command seems to be
different from explanation of the manual. Please tell me which is
correct performance, the result of command or the explanation of manual.
I show the details as follows.
[Events]
The encoding that psql command sets has difference between the result of command
and the explanation of manual.
The following is the explanation of encoding that psql command sets,
which I made extracts from the 9.2 manual.
---------------------------------------------------------------------------
VI. Reference / II. PostgreSQL Client Applications / psql / Connecting to a Database
"If at least one of standard input or standard output are a terminal,
then psql sets the client encoding to "auto",
which will detect the appropriate client encoding from the locale settings
(LC_CTYPE environment variable on Unix systems).
If this doesn't work out as expected,
the client encoding can be overridden using the environment variable PGCLIENTENCODING."
----------------------------------------------------------------------------
Above explanation says that "If at least one of standard input or standard output
are a terminal, then psql sets the client encoding to "auto",
which will detect the appropriate client encoding from the locale settings
(LC_CTYPE environment variable on Unix systems)".
But according to the result from psql command, it seems that the appropriate
client encoding is NOT detected from the locale settings.
The result of psql command is following.
[Precondition of test]
- PostgreSQL VL:9.2.4
- Locale settings encoding : ja_JP.eucJP (LANG)
- Client encoding:UTF8
- client_encoding(paramater of postgresql.conf) : None specified
- "test.txt" is psql's input file which is written "\encoding".
[Result]
1) In case both standard input and standard output are a terminal
$ psql postgres -f test.txt -o result.txt
EUC_JP
→ Locale setting encoding
2) In case only standard input is a terminal
$ psql postgres -f test.txt > result.txt
$ cat result.txt
UTF8
→Client encoding
3) In case only standard output is a terminal
$ psql postgres -o result.txt < test.txt
UTF8
→Client encoding
4) In case both standard input and standard output are not a terminal
$ psql postgres < test.txt > result.txt
$ cat result.txt
UTF8
→Client encoding
1) and 4) performed just as manual, but 2) and 3) do not.
If 2) and 3) performed just as munual, I think that their encoding should be EUC_JP
that is locale setting encoding.
If manual has mistake, I think that correct explanation is following.
"If BOTH standard input AND standard output are a terminal, then psql sets
the client encoding to "auto", which will detect the appropriate client encoding
from the locale settings (LC_CTYPE environment variable on Unix systems)."
What do you think?
Warmest Regards.
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Broniewski | 2014-02-06 08:01:54 | Hard upgrade (everything) |
Previous Message | Torsten Förtsch | 2014-02-06 05:51:51 | Re: How to get rid of superfluous WAL segments? |
From | Date | Subject | |
---|---|---|---|
Next Message | Marti Raudsepp | 2014-02-06 08:39:41 | Re: PoC: Partial sort |
Previous Message | Gavin Flower | 2014-02-06 05:11:44 | Re: Performance Improvement by reducing WAL for Update Operation |