Thread: BUG #15509: Pg_Dump failed if Database name contains non asciicharacters

BUG #15509: Pg_Dump failed if Database name contains non asciicharacters

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      15509
Logged by:          vinod tv
Email address:      vinod.t.v@outlook.com
PostgreSQL version: 9.6.10
Operating system:   Windows 10
Description:

Steps:
1) While installing postgres i have selected only Locale [Default Locale]
and install postgres in win10

2) Create a database with non ascii name example : Química Ltda
Script used :-
CREATE DATABASE "Química Ltda"  WITH ENCODING='UTF8'  OWNER postgres
CONNECTION LIMIT=-1;

3) Use command prompt to take a pg_dump
Command used
--host localhost --port 7555 --username postgres --format=d --verbose
--jobs=10 --compress 9 --file "C:\Delete\vt" --dbname "Química"

4) Error thrown 
pg_dump: [archiver (db)] connection to database "Química Ltda" failed:
FATAL:  database "Química Ltda" does not exist

Expecting a reply...


=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> 1) While installing postgres i have selected only Locale [Default Locale]
> and install postgres in win10

What would "Default Locale" mean?

> 2) Create a database with non ascii name example : Química Ltda
> Script used :-
> CREATE DATABASE "Química Ltda"  WITH ENCODING='UTF8'  OWNER postgres  
> CONNECTION LIMIT=-1;

> 3) Use command prompt to take a pg_dump
> Command used
> --host localhost --port 7555 --username postgres --format=d --verbose 
> --jobs=10 --compress 9 --file "C:\Delete\vt" --dbname "Química"

> 4) Error thrown 
> pg_dump: [archiver (db)] connection to database "Química Ltda" failed:
> FATAL:  database "Química Ltda" does not exist

The most likely theory here is that the encoding that was used to store
the name "Química Ltda" is not the same one that your terminal window
is using.  Postgres doesn't provide any mechanism for transcoding database
or role names --- whatever bytes show up in the connection request packet
have to match what is in pg_database (resp. pg_authid).  It'd be nice to
do better than that, but generally we have little idea at that point what
encoding the client thinks it's using.

Note that the command you show above doesn't guarantee that the database
name was stored with UTF8 encoding --- it would've been whatever encoding
was in use in the database you issued the CREATE DATABASE command in.

            regards, tom lane