Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDnAO-003Dc7-C3 for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Nov 2024 16:02:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tDnAL-0077uW-Ny for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Nov 2024 16:02:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDnAL-0077sa-FE for pgsql-bugs@lists.postgresql.org; Wed, 20 Nov 2024 16:02:53 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDnAJ-002txb-1B for pgsql-bugs@lists.postgresql.org; Wed, 20 Nov 2024 16:02:52 +0000 Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-4609967ab7eso14997831cf.3 for ; Wed, 20 Nov 2024 08:02:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732118570; x=1732723370; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Iv3fQHuhkPz05OOLkBHO5GtkIR1bh74kqjDQR4eMEhM=; b=Mn/6TbaySo9PNNkytApOPF2vTxrSlJDvuD72MEr/MSMOv8/dHLPxz3igj527uHFToD NOtyk2dvtquMz0DyhUZDfT+IJQDFGVAmIDI6Hm5UtiBp002eRfQq5xngwm1Q1jq+WUg2 wEDFLMM8RqIlU8XzlzvNfvfFehuEvBw1kxE7a+o1e+yjPxc2N8SOXbpRrIcwIgkp1ef/ zNIPtYceYxndwBT28HSOPsor8HzxeUlyTXFkLU+LSSdQG0QfDtBDth14M0Ekz7VwN98M 4Kf0ek7z+iOLcYjouqCux+GeAGiw4K3LDxGTQ6mfrfC5/gwAimCRbBOzM/GK0CyHohvF V/XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732118570; x=1732723370; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Iv3fQHuhkPz05OOLkBHO5GtkIR1bh74kqjDQR4eMEhM=; b=YD9REIHrB1wQmmWYRfudOdJ43ykGDNk+x+vLn5m7M2e37loNXMyE/uVB5kj/L1mVXt qqNNqKEf1zsgOAZCbfGJ1ht6TybRQx6qeDhii1h1dCuub2zI+OSA2fBVZgqU1+KoItdi OmYeXiNhCuV041ji8aUhdVNeoA90qNEyyvtOpNnC52gEvTyU37Tix7XCPC7AlHbfHqBI LA9pjArJFZAq5l5TjO+75nyHrkmWHIyaQNcStcDhL8OZJaDE2EFYfHT1gF8hGHbvh3U/ Un2fqkuzs/PN+J73IWoukPgjvkrDtCstDsSnaqJ7jM8M3IlHu/48c/MARUIkJThc3zxu Oe9g== X-Forwarded-Encrypted: i=1; AJvYcCWfme4UZJPlvjpoM9ZEdBq/Gl8NhBWjt6V6iAiod2uZPyo3HIUlN/qEQiyubGjlrM/CEvVuEATzM4VE@lists.postgresql.org X-Gm-Message-State: AOJu0Yw0etjzmWXVCt1qtG3+CyLljqKjXh9HIB1ZrXx49tvxuNKGY4ad VJahmagXzoCzj4HEE4ygphopd6OfPxax6pGFjJXdtueWpNm9olM3 X-Gm-Gg: ASbGncuXg96nUWErGDZEOoitp7g0vhmBfpa1Me3mXvX7q1mx4gOuWN6Qo+JdVJRSlte iHjMeRyNdJ3c2uBZ+aMAUis/lVcuTo2V7+IMCSfZTm21+LCdn/QUW0imweRO+qOq/skxRKw0qA7 ObACbnvARF3HIXX2Nj35GErs0lM49eF0JUYvqLerWZLWXWoZP/DuMneBkSsixn2paFVhd/6+XS1 rKfl6KVMh10aGMGL68RyEcEaGOkXKgoOa01BgseI/+T5gQbfcmV1FRYyfvy5K6QWY5y8OBq65xY 4dvYfMGVa/FqFYZq3lIFVXJ/ECP8Q/TrrAk2ukjF X-Google-Smtp-Source: AGHT+IFNjifO+hKIkpomql1ZhP6Uz8SQduQLkHxJCGYnqi6/2SCQjn2ArqZ1LZml5XK9qeaVNc78GQ== X-Received: by 2002:a05:6214:2423:b0:6d3:f671:8913 with SMTP id 6a1803df08f44-6d437859d73mr47115426d6.35.1732118569932; Wed, 20 Nov 2024 08:02:49 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d43812b6e7sm12185366d6.71.2024.11.20.08.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 08:02:49 -0800 (PST) Date: Wed, 20 Nov 2024 10:02:47 -0600 From: Nathan Bossart To: Tom Lane Cc: adam@labkey.com, Bertrand Drouvot , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails Message-ID: References: <18711-7503ee3e449d2c47@postgresql.org> <3072825.1731866414@sss.pgh.pa.us> <3796535.1732044807@sss.pgh.pa.us> <3976665.1732057784@sss.pgh.pa.us> <75265.1732076593@sss.pgh.pa.us> <154104.1732118090@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <154104.1732118090@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 20, 2024 at 10:54:50AM -0500, Tom Lane wrote: > Nathan Bossart writes: >> 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. > > I'm failing to parse your (2). Either that's content-free or you're > thinking something that probably isn't true. There are encodings > (mostly the LATINn series) that have high-bit-set characters that > only occupy one byte. So I don't think we can take any shortcuts > compared to the strip-one-byte-at-a-time approach. I'm probably missing something here, sorry. Upthread, you mentioned that we could bypass multiple lookups unless both the NAMEDATALEN-1'th and NAMEDATALEN-2'th bytes are non-ASCII. But if there are encodings with the high bit set that don't require multiple bytes per character, then how can we do that? For example, let's say the initially-truncated identifier ends with an ASCII byte followed by a non-ASCII byte. That last byte might be a LATIN1 character, or it could be the beginning of a character that requires multiple bytes, so we need to lookup both the initially truncated string as well as the string with one extra byte truncated, right? -- nathan