agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Generate unicode_limits.h.
Date: Fri, 17 Jul 2026 23:43:12 +0000
Message-ID: <E1wksD2-000h1a-0N@gemulon.postgresql.org> (raw)

Generate unicode_limits.h.

To ensure we do not overflow a size_t while case mapping on a 32-bit
platform, we need to know the maximum amount a UTF8 string can expand.

Calculate that maximum while generating unicode tables as a part of
the update-unicode target, and output into a new header
unicode_limits.h. Minor refactoring along the way.

Add a StaticAssertDecl to check that a MaxAllocSize text value
expanded by that amount would still have a length that fits in
size_t. (We couldn't actually create a new text value out of that, but
we still need to avoid overflow.)

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3213927.1783950167@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2cf212db5286baa7d7e80449300fe472d8c4ba9f

Modified Files
--------------
src/backend/utils/adt/pg_locale_builtin.c         |  11 ++
src/common/unicode/Makefile                       |   6 +-
src/common/unicode/generate-unicode_case_table.pl | 194 +++++++++++++++-------
src/common/unicode/meson.build                    |   2 +-
src/common/unicode_case.c                         |  12 +-
src/include/common/unicode_case_table.h           |   9 +-
src/include/common/unicode_limits.h               |  39 +++++
7 files changed, 202 insertions(+), 71 deletions(-)



Message-ID: <E1wksD2-000h1a-0N@gemulon.postgresql.org>
Permalink:  ../E1wksD2-000h1a-0N@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wksD2-000h1a-0N@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: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Generate unicode_limits.h.
  In-Reply-To: <E1wksD2-000h1a-0N@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox