Thread

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

    Jeff Davis <pgsql@j-davis.com> — 2026-05-05T20:23:12Z

    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