Re: Refactor: allow pg_strncoll(), etc., to accept -1 length for NUL-terminated cstrings.

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Refactor: allow pg_strncoll(), etc., to accept -1 length for NUL-terminated cstrings.
Date: 2026-05-05 20:23:12
Message-ID: 56d386147d2f0a269c7b8644eee05d1dce4aa80d.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2026-05-01 at 12:40 -0400, Andres Freund wrote:
> Hi,
>
> On 2024-08-22 11:00:54 -0700, Jeff Davis wrote:
> > Like ICU, allow -1 length to mean that the input string is NUL-
> > terminated for pg_strncoll(), pg_strnxfrm(), and
> > pg_strnxfrm_prefix().
> >
> > This simplifies the API and code a bit.
>
> I don't really like this.

Agreed. I did this to match up with the ICU API a bit better, but if
it's interfering with useful tools, then the special cases aren't worth
it.

Patch attached. It causes a bit of churn, so one disadvantage is that
it will complicate future backports in this area.

Regards,
Jeff Davis

Attachment Content-Type Size
v1-0001-Don-t-accept-length-of-1-in-pg_locale.h-APIs.patch text/x-patch 48.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-05-05 20:32:41 Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
Previous Message SATYANARAYANA NARLAPURAM 2026-05-05 20:05:51 Re: Changing the state of data checksums in a running cluster