Re: Changes to pg_dump/psql following collation "C" in the catalog

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Chapman Flack" <chap(at)anastigmatix(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Changes to pg_dump/psql following collation "C" in the catalog
Date: 2019-04-05 12:18:53
Message-ID: 1247dcf3-f3bd-4047-9a0a-6a047377db84@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chapman Flack wrote:

> >> "Daniel Verite" <daniel(at)manitou-mail(dot)org> writes:
> >>> One consequence of using the "C" collation in the catalog versus
> >>> the db collation
>
> As an intrigued Person Following At Home, I was happy when I found
> this little three-message thread had more context in [1] and [2]. :)
>
> -Chap
>
> [1] https://postgr.es/m/15938.1544377821@sss.pgh.pa.us
> [2] https://postgr.es/m/5978.1544030694@sss.pgh.pa.us

Yes. The concrete issue that the patch addresses can be illustrated
with this example:

psql (12devel)
Type "help" for help.

postgres=# show lc_collate ;
lc_collate
-------------
fr_FR.UTF-8
(1 row)

postgres=# create table année_2018();
CREATE TABLE

postgres=# \dt '\\w+_\\d+'
psql: error: Did not find any relation named "\w+_\d+".

In previous versions it would have found the table with the accent
in the name. With 12devel it doesn't, because the match is done with
the collation of the column, now "C", which does not consider the
accented character to be a letter.
This also affects pg_dump with the -t and -n switches that
accept patterns and I think pretty much all \d* commands
that accept patterns too.

The purpose of the fix is for the patterns to give the same results as
before. It's done by simply adding explicit collate clauses to use the
collation of the database for these comparisons.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2019-04-05 12:48:03 Re: [PATCH v20] GSSAPI encryption support
Previous Message Surafel Temesgen 2019-04-05 12:14:56 Re: FETCH FIRST clause PERCENT option