Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, adam(at)labkey(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails
Date: 2024-11-27 15:40:13
Message-ID: Z0c9XVU6aTd8neRr@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 22, 2024 at 02:17:07PM -0600, Nathan Bossart wrote:
> On Fri, Nov 22, 2024 at 03:07:46PM -0500, Tom Lane wrote:
>> Nathan Bossart <nathandbossart(at)gmail(dot)com> writes:
>>> I think we'll also want to do something about MyProcPort->database_name
>>
>> Huh, isn't that getting filled from InitPostgres's out_dbname?
>
> I think ProcessStartupPacket() sets it. That's called by
> BackendInitialize(), which is called before PostgresMain() (which is what
> ultimately calls InitPostgres()). The truncation used to happen within
> ProcessStartupPacket(), and it updated MyProcPort directly.

Here's an attempt at dealing with this problem. I've just taught
PostgresMain() to use out_dbname to update MyProcPort->database_name and
the process title as needed. Of course, we still need to handle role
names, too...

That being said, I'm growing quite uneasy about the size of this hack, and
I'm wondering if it would be better to leave it alone (perhaps with an
update to the release notes) or just revert commit 562bee0 until we have a
better way of dealing with multibyte characters in identifiers (e.g.,
tracking their encoding). I suspect there are similar problems in other
places (e.g., pg_dumpall).

--
nathan

Attachment Content-Type Size
v8-0001-fix-database-name-truncation.patch text/plain 8.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-11-27 15:42:36 BUG #18725: "set role" requires "grant connect on database"
Previous Message Tom Lane 2024-11-27 14:54:15 Re: Build failure with GCC 15 (defaults to -std=gnu23)