From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: adam@labkey.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails
Date: Wed, 20 Nov 2024 10:39:35 -0500
Message-ID: <152768.1732117175@sss.pgh.pa.us> (raw)
In-Reply-To: <Zz4BH8z_Oby0gR5X@nathan>
References: <18711-7503ee3e449d2c47@postgresql.org>
<3072825.1731866414@sss.pgh.pa.us>
<Zzzdc1QLIuFoiTvE@nathan>
<3796535.1732044807@sss.pgh.pa.us>
<Zz0WPCEzx-mPvUxA@nathan>
<3976665.1732057784@sss.pgh.pa.us>
<Zz2bBxJP8uoy2UkT@ip-10-97-1-34.eu-west-3.compute.internal>
<149256.1732115451@sss.pgh.pa.us>
<Zz3+TWanHHjBUErS@ip-10-97-1-34.eu-west-3.compute.internal>
<Zz4BH8z_Oby0gR5X@nathan>
Nathan Bossart <nathandbossart@gmail.com> writes:
> On Wed, Nov 20, 2024 at 03:20:45PM +0000, Bertrand Drouvot wrote:
>> I had in mind to "fully scan" pg_database in GetDatabaseTuple(), get the datname
>> and encoding from FormData_pg_database and start from there the comparison
>> with the dbname passed as an argument to GetDatabaseTuple(). Thoughts?
> I was wondering if we could use the database encoding to disambiguate if we
> found multiple matches, but IIUC the identifier will be truncated using the
> encoding of the database from which it was created.
Yeah, you can't really assume that a database's name is stored using
the encoding of that database. And even if you did, you still can't
make any assumptions about pg_role. I doubt we want to do this
differently for roles than databases.
We've had some past discussions about tightening all this up, like
insisting that names in shared catalogs are always in UTF8. But
there are downsides to that too.
In any case, there is no way that a seqscan of pg_database (or
pg_role) is going to be adequately performant, let alone faster
than at-most-four indexed probes. We just had somebody inquiring
about whether it'd be okay to create a million roles...
regards, tom lane
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: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, bertranddrouvot.pg@gmail.com, adam@labkey.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails
In-Reply-To: <152768.1732117175@sss.pgh.pa.us>
* 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