Preserve versions of initdb-created collations in pg_upgrade

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Preserve versions of initdb-created collations in pg_upgrade
Date: 2019-10-28 12:52:02
Message-ID: aeb9e99a-f296-d81b-8e44-ff96c68473b7@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As mentioned in [0], pg_upgrade currently does not preserve the version
of collation objects created by initdb. Here is an attempt to fix that.

The way I deal with this here is by having the binary-upgrade mode in
pg_dump delete all the collations created by initdb and then dump out
CREATE COLLATION commands with version information normally.

I had originally imagined doing some kind of ALTER COLLATION (or perhaps
a direct UPDATE pg_collation) to update the version information, but
that doesn't really work because we don't know whether the collation
object with a given name in the new cluster is the same as the one in
the old cluster. So it seems more robust to just delete all existing
collations and create them from scratch.

Thoughts?

[0]:
https://www.postgresql.org/message-id/CA+hUKGKDe98DFWKJoS7e4Z+Oamzc-1sZfpL3V3PPgi1uNvQ1tw@mail.gmail.com
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v1-0001-Preserve-versions-of-initdb-created-collations-in.patch text/plain 2.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-10-28 12:53:58 Re: [Proposal] Arbitrary queries in postgres_fdw
Previous Message Pavel Stehule 2019-10-28 12:48:24 Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'