pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't truncate database and user names in startup packets.
Date: Mon, 03 Jul 2023 20:20:00 +0000
Message-ID: <E1qGQ1g-001lDr-RY@gemulon.postgresql.org> (raw)

Don't truncate database and user names in startup packets.

Unlike commands such as CREATE DATABASE, ProcessStartupPacket()
does not perform multibyte-aware truncation of overlength names.
This means that connection attempts might fail even if the user
provides the same overlength names that were used in CREATE
DATABASE, CREATE ROLE, etc.  Ideally, we'd do the same multibyte-
aware truncation in both code paths, but it doesn't seem worth the
added complexity of trying to discover the encoding of the names.
Instead, let's simply skip truncating the names in the startup
packet and let the user/database lookup fail later on.  With this
change, users must provide the exact names stored in the catalogs,
even if the names were truncated.

This reverts commit d18c1d1f51.

Author: Bertrand Drouvot
Reviewed-by: Kyotaro Horiguchi, Tom Lane
Discussion: https://postgr.es/m/07436793-1426-29b2-f924-db7422a05fb7%40gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/562bee0fc13dc95710b8db6a48edad2f3d052f2e

Modified Files
--------------
src/backend/postmaster/postmaster.c | 9 ---------
1 file changed, 9 deletions(-)



Message-ID: <E1qGQ1g-001lDr-RY@gemulon.postgresql.org>
Permalink:  ../E1qGQ1g-001lDr-RY@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qGQ1g-001lDr-RY@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Don't truncate database and user names in startup packets.
  In-Reply-To: <E1qGQ1g-001lDr-RY@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