From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve makeArrayTypeName's algorithm for choosing array type na
Date: Tue, 26 Jul 2022 19:38:28 +0000
Message-ID: <E1oGQNv-001Nl5-MN@gemulon.postgresql.org> (raw)
Improve makeArrayTypeName's algorithm for choosing array type names.
As before, we start by prepending one underscore (truncating the
base name if necessary). But if there is a conflict, then instead of
prepending more and more underscores, append an underscore and some
digits, in much the same way that ChooseRelationName does. While
the previous logic could be driven to fail by creating a lot of
types with long names differing only near the end, this version seems
certain enough to eventually succeed that we can remove the failure
code path that was there before.
While at it, undo 6df7a9698's decision to split this code out of
makeArrayTypeName. That wasn't actually accomplishing anything,
because no other function was using it --- and it would have been
wrong to do so. The convention that a prefix "_" means an array,
not something else, is too ancient to mess with.
Andrey Lepikhov and Dmitry Koval, reviewed by Masahiko Sawada and myself
Discussion: https://postgr.es/m/b84cd82c-cc67-198a-8b1c-60f44e1259ad@postgrespro.ru
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/70988b7b0a0bd03c59a2314d0b5bcf2135692349
Modified Files
--------------
src/backend/catalog/pg_type.c | 90 ++++++++++++-------------------
src/test/regress/expected/alter_table.out | 6 +--
2 files changed, 37 insertions(+), 59 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Improve makeArrayTypeName's algorithm for choosing array type na
In-Reply-To: <E1oGQNv-001Nl5-MN@gemulon.postgresql.org>
References: <E1oGQNv-001Nl5-MN@gemulon.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