Re: Stop asserting that Unicode normalization consumes its whole input - Mailing list pgsql-hackers

From John Naylor
Subject Re: Stop asserting that Unicode normalization consumes its whole input
Date
Msg-id CANWCAZZYbQw4MwA7_E-0RXwv8oCvbpy+P2AEur5OieT-3_=8Fw@mail.gmail.com
Whole thread
In response to Stop asserting that Unicode normalization consumes its whole input  ("Tristan Partin" <tristan@partin.io>)
Responses Re: Stop asserting that Unicode normalization consumes its whole input
List pgsql-hackers
On Sat, Sep 19, 2026 at 12:00 AM Tristan Partin <tristan@partin.io> wrote:
>
> normalize() and IS NORMALIZED determine how many code points their input
> holds with pg_mbstrlen_with_len(). They then decode exactly that many
> code points, and assert afterward that this consumed the entire datum.
> That invariant does not hold because pg_mbstrlen_with_len() stops at the
> first of "limit" or a NUL.

The limit here is VARSIZE_ANY_EXHDR(input) , which is the entire
length. This patch seems like it's weakening an assertion for a case
that shouldn't happen. (I haven't looked at the tests in encoding.sql
that force non-standard behavior, so I'm not sure what the context was
there...)

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: [PATCH] Refactor *_abbrev_convert() functions
Next
From: John Naylor
Date:
Subject: Re: Move system identifier generation to a common helper