From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
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: Wed, 20 Nov 2024 09:35:33 -0600
Message-ID: <Zz4BxVqAZnWHFXFB@nathan> (raw)
In-Reply-To: <75265.1732076593@sss.pgh.pa.us>
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>
<Zz1bvchIEQPT6eTr@nathan>
<75265.1732076593@sss.pgh.pa.us>
On Tue, Nov 19, 2024 at 11:23:13PM -0500, Tom Lane wrote:
> Nathan Bossart <nathandbossart@gmail.com> writes:
>> I'm admittedly not an expert in the multi-byte code, but since there are
>> encodings like LATIN1 that use a byte per character, don't we need to do
>> multiple lookups any time the NAMEDATALEN-1'th byte is non-ASCII?
>
> I don't think so, but maybe I'm missing something. An important
> property of backend-legal encodings is that all bytes of a multibyte
> character have their high bits set. Thus if the NAMEDATALEN-2'th
> byte does not have that, it is not part of a multibyte character.
> That's also the reason we can stop if we reach a high-bit-clear
> byte while backing up to earlier bytes.
That's good to know. If we can assume that 1) all bytes of a multibyte
character have the high bit set and 2) all multibyte characters actually
require multiple bytes, then there are just a handful of cases that require
multiple lookups, and we can restrict even those to some extent, too.
--
nathan
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: nathandbossart@gmail.com, tgl@sss.pgh.pa.us, 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: <Zz4BxVqAZnWHFXFB@nathan>
* 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