[17+] check after second call to pg_strnxfrm is too strict, relax it

Started by Jeff Davisover 2 years ago3 messageshackers
Jump to latest
#1Jeff Davis
pgsql@j-davis.com

I noticed this comment in selfuncs.c regarding strxfrm():

/*
* Some systems (e.g., glibc) can return a smaller value from the
* second call than the first; thus the Assert must be <= not ==.
*/

Some callers of pg_strnxfrm() are not allowing for that possibility.

Patch attached, which should be backported to 17.

Regards,
Jeff Davis

Attachments:

0001-Relax-check-for-return-value-from-second-call-of-pg_.patchtext/x-patch; charset=UTF-8; name=0001-Relax-check-for-return-value-from-second-call-of-pg_.patchDownload+10-11
#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Jeff Davis (#1)
Re: [17+] check after second call to pg_strnxfrm is too strict, relax it

On 30/07/2024 22:31, Jeff Davis wrote:

I noticed this comment in selfuncs.c regarding strxfrm():

/*
* Some systems (e.g., glibc) can return a smaller value from the
* second call than the first; thus the Assert must be <= not ==.
*/

Some callers of pg_strnxfrm() are not allowing for that possibility.

Patch attached, which should be backported to 17.

+1. A comment in the pg_strnxfrm() function itself would be good too.

--
Heikki Linnakangas
Neon (https://neon.tech)

#3Jeff Davis
pgsql@j-davis.com
In reply to: Heikki Linnakangas (#2)
Re: [17+] check after second call to pg_strnxfrm is too strict, relax it

On Tue, 2024-07-30 at 23:01 +0300, Heikki Linnakangas wrote:

+1. A comment in the pg_strnxfrm() function itself would be good too.

Committed, thank you. Backported to 16 (original email said 17, but
that was a mistake).

Regards,
Jeff Davis