A client and server encoding question

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: A client and server encoding question
Date: 2013-10-22 08:21:20
Message-ID: CA+HiwqGDYcgmxp4D9J4MhojmZod0-+xZ2XW4A8XcdV=3ehH6+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

With a server initdb'd with UTF8 encoding , if I create a table with a
client using LATIN1 encoding and later try to work with the relation
with a client using UTF8 encoding (both the scenarios simulated using
single session of psql but with different client_encoding set), there
is an error. Following might help illustrate the problem:

psql (9.2.4)
Type "help" for help.

postgres=# SHOW server_encoding;
server_encoding
-----------------
UTF8
(1 row)
Time: 0.761 ms

postgres=# SET client_encoding TO LATIN1;
SET
Time: 1.382 ms

postgres=# create table id_äß(ID int);
CREATE TABLE
Time: 31.344 ms

postgres=# \dt
List of relations
Schema | Name | Type | Owner
--------+---------+-------+-------
public | id_äß | table | amit
(1 row)

postgres=# SET client_encoding TO UTF8;
SET
Time: 1.007 ms

postgres=# \dt
List of relations
Schema | Name | Type | Owner
--------+--------------+-------+-------
public | id_äÃ\u009F | table | amit
(1 row)

postgres=# drop table id_äß;
ERROR: table "id_äß" does not exist
Time: 1.668 ms

postgres=# SET client_encoding TO LATIN1;
SET
Time: 0.745 ms

postgres=# drop table id_äß;
DROP TABLE
Time: 16.954 ms

But, I had an impression that above shouldn't have caused any problem?
Should UTF8 handle the situation gracefully? Or am I missing
something?

--
Amit Langote

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Luca Ferrari 2013-10-22 09:05:34 Re: how to get the connected session pointer ( Archive * AH)
Previous Message Luca Ferrari 2013-10-22 06:41:34 Re: pg_dumpall from a script