pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: adam@labkey.com, Bertrand Drouvot <bertranddrouvot.pg@gmail.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: Tue, 19 Nov 2024 18:09:44 -0500
Message-ID: <3976665.1732057784@sss.pgh.pa.us> (raw)
In-Reply-To: <Zz0WPCEzx-mPvUxA@nathan>
References: <18711-7503ee3e449d2c47@postgresql.org>
	<3072825.1731866414@sss.pgh.pa.us>
	<Zzzdc1QLIuFoiTvE@nathan>
	<3796535.1732044807@sss.pgh.pa.us>
	<Zz0WPCEzx-mPvUxA@nathan>

Nathan Bossart <nathandbossart@gmail.com> writes:
> On Tue, Nov 19, 2024 at 02:33:27PM -0500, Tom Lane wrote:
>> I did think of a way that we could approximate encoding-correct
>> truncation here, relying on the fact that what's in pg_database
>> is encoding-correct according to somebody:
>> ...

> That's an interesting idea.  That code would probably need to live in
> GetDatabaseTuple(), but it seems doable.  We might be able to avoid the
> "mighty improbable" case by always truncating up to
> MAX_MULTIBYTE_CHAR_LEN-1 times and failing if there are multiple matches,
> too.

Hmm ... but with short characters (e.g. LATIN1) there might be
legitimately-different names that that rule would complain about.
Still, the workaround remains "so spell it like it is in the catalog".
On balance I think that's an improvement over what I was visualizing.

Also, we could bypass the multiple lookups unless both the
NAMEDATALEN-1'th and NAMEDATALEN-2'th bytes are non-ASCII, which
should be rare enough to make it not much of a performance issue.

One annoying point is that we also need this for role lookup.

			regards, tom lane





view thread (67+ messages)  latest in thread

Message-ID: <3976665.1732057784@sss.pgh.pa.us>
Permalink:  ../3976665.1732057784@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3976665.1732057784@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, bertranddrouvot.pg@gmail.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: <3976665.1732057784@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