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: alexander.kass@jetbrains.com
Subject: BUG #16679: Incorrect encoding of database name
Date: Tue, 20 Oct 2020 10:44:22 +0000
Message-ID: <16679-c5176aa79b558094@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16679
Logged by:          Alexander Kass
Email address:      alexander.kass@jetbrains.com
PostgreSQL version: 13.0
Operating system:   Linux
Description:        

Steps to reproduce:
1. Create database with name & encoding that won't binary match utf8 encoded
name, e.g:
> create database Français
    LC_COLLATE 'fr_FR@euro' LC_CTYPE 'fr_FR@euro'
    encoding 'latin9' template template0;
2. Now check pg_database from different databases:
aurora=> \connect français
français=> select * from pg_database;
  datname  | datdba | encoding | datcollate  |  datctype   | datistemplate |
datallowconn | datconnlimit | datlastsysoid | datfrozenxid | datminmxid |
dattablespace |               datacl
-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+------------+---------------+-------------------------------------
 postgres  |  16399 |        6 | en_US.UTF-8 | en_US.UTF-8 | f             |
t            |           -1 |         13933 |          549 |          1 |   
      1663 |
 français |  16399 |       16 | fr_FR@euro  | fr_FR@euro  | f             |
t            |           -1 |         13933 |          549 |          1 |   
      1663 |
..........

français=> \connect postgres
postgres=> select * from pg_database;
  datname  | datdba | encoding | datcollate  |  datctype   | datistemplate |
datallowconn | datconnlimit | datlastsysoid | datfrozenxid | datminmxid |
dattablespace |               datacl
-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+------------+---------------+-------------------------------------
 postgres  |  16399 |        6 | en_US.UTF-8 | en_US.UTF-8 | f             |
t            |           -1 |         13933 |          549 |          1 |   
      1663 |
 français  |  16399 |       16 | fr_FR@euro  | fr_FR@euro  | f             |
t            |           -1 |         13933 |          549 |          1 |   
      1663 |
...........

See incorrectly encoded database name. The same applies for
current_database().
If I do encode(datname::bytea, 'hex') result is matches. It looks like
automatic conversion latin9 -> utf8 is done for français database, but name
is already utf8.
Checked on PG13 & aws aurora



view thread (2+ messages)  latest in thread

Message-ID: <16679-c5176aa79b558094@postgresql.org>
Permalink:  ../16679-c5176aa79b558094@postgresql.org/
Also on:    postgresql.org/message-id/16679-c5176aa79b558094@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, alexander.kass@jetbrains.com
  Subject: Re: BUG #16679: Incorrect encoding of database name
  In-Reply-To: <16679-c5176aa79b558094@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