Re: Refactor to introduce pg_strcoll(). - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Refactor to introduce pg_strcoll().
Date
Msg-id 0a65336c-a3e6-20a5-55fe-b7b50dd73fa4@enterprisedb.com
Whole thread Raw
In response to Refactor to introduce pg_strcoll().  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Refactor to introduce pg_strcoll().  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
On 07.10.22 01:15, Jeff Davis wrote:
> + * Call ucol_strcollUTF8(), ucol_strcoll(), strcoll(), strcoll_l(), wcscoll(),
> + * or wcscoll_l() as appropriate for the given locale, platform, and database
> + * encoding. Arguments must be NUL-terminated. If the locale is not specified,
> + * use the database collation.
> + *
> + * If the collation is deterministic, break ties with memcmp(), and then with
> + * the string length.
> + */
> +int
> +pg_strcoll(const char *arg1, int len1, const char *arg2, int len2,
> +           pg_locale_t locale)

It's a bit confusing that arguments must be NUL-terminated, but the 
length is still specified.  Maybe another sentence to explain that would 
be helpful.

The length arguments ought to be of type size_t, I think.




pgsql-hackers by date:

Previous
From: Dmitry Koval
Date:
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Next
From: "shiy.fnst@fujitsu.com"
Date:
Subject: RE: [RFC] building postgres with meson - v13