Re: Inconsistent results with libc sorting on Windows

2023-08-11 Thread Noah Misch
On Fri, Aug 11, 2023 at 11:48:18AM +0200, Juan José Santamaría Flecha wrote: > On Fri, Aug 11, 2023 at 7:29 AM Noah Misch wrote: > > > > > The LCMapStringEx() solution is elegant. I do see > > > > https://learn.microsoft.com/en-us/windows/win32/intl/handling-sorting-in-your-applications > > says

Re: Inconsistent results with libc sorting on Windows

2023-08-11 Thread Juan José Santamaría Flecha
On Fri, Aug 11, 2023 at 7:29 AM Noah Misch wrote: > > The LCMapStringEx() solution is elegant. I do see > > https://learn.microsoft.com/en-us/windows/win32/intl/handling-sorting-in-your-applications > says, "If an application calls the function to create a sort key for a > string > containing an

Re: Inconsistent results with libc sorting on Windows

2023-08-10 Thread Noah Misch
On Wed, Jun 14, 2023 at 12:50:28PM +0200, Juan José Santamaría Flecha wrote: > On Wed, Jun 14, 2023 at 4:13 AM Peter Geoghegan wrote: > > > On Tue, Jun 13, 2023 at 5:59 PM Thomas Munro > > wrote: > > > Trying to follow along here... you're doing the moral equivalent of > > > strxfrm(), so sort k

Re: Inconsistent results with libc sorting on Windows

2023-07-03 Thread Juan José Santamaría Flecha
El lun, 3 jul 2023, 17:42, Alvaro Herrera escribió: > On 2023-Jun-19, Juan José Santamaría Flecha wrote: > > > Ok, let's see where the report goes: > > > > > https://developercommunity.visualstudio.com/t/CompareStringEx-non-transitive/10393003?q=comparestringex > > Hm, so this appears to have bee

Re: Inconsistent results with libc sorting on Windows

2023-07-03 Thread Alvaro Herrera
On 2023-Jun-19, Juan José Santamaría Flecha wrote: > Ok, let's see where the report goes: > > https://developercommunity.visualstudio.com/t/CompareStringEx-non-transitive/10393003?q=comparestringex Hm, so this appears to have been marked as solved by Microsoft. Can you recheck? Also, what does

Re: Inconsistent results with libc sorting on Windows

2023-06-19 Thread Juan José Santamaría Flecha
On Thu, Jun 15, 2023 at 1:57 AM Thomas Munro wrote: > > Given that the documented behaviour is that ".. the sort key produces > the same order as when the source string is used in CompareString or > CompareStringEx"[1], this seems like a reportable bug, unless perhaps > your test program is hidin

Re: Inconsistent results with libc sorting on Windows

2023-06-14 Thread Thomas Munro
On Wed, Jun 14, 2023 at 10:50 PM Juan José Santamaría Flecha wrote: > Yes, I think the situation is quite similar to what you describe, with its > WIN32 peculiarities. Take for example the attached program, it'll output: > > s1 = s2 > s2 = s3 > s1 > s3 > c1 > c2 > c2 > c3 > c1 > c3 > > As you can

Re: Inconsistent results with libc sorting on Windows

2023-06-14 Thread Juan José Santamaría Flecha
On Wed, Jun 14, 2023 at 4:13 AM Peter Geoghegan wrote: > On Tue, Jun 13, 2023 at 5:59 PM Thomas Munro > wrote: > > Trying to follow along here... you're doing the moral equivalent of > > strxfrm(), so sort keys have the transitive property but direct string > > comparisons don't? Or is this bec

Re: Inconsistent results with libc sorting on Windows

2023-06-13 Thread Thomas Munro
Trying to follow along here... you're doing the moral equivalent of strxfrm(), so sort keys have the transitive property but direct string comparisons don't? Or is this because LCIDs reach a different algorithm somehow (or otherwise why do you need to use LCIDs for this, when there is a non-LCID v

Re: Inconsistent results with libc sorting on Windows

2023-06-12 Thread Juan José Santamaría Flecha
On Fri, Jun 9, 2023 at 11:18 AM Daniel Verite wrote: > Juan José Santamaría Flecha wrote: > > > Just to make sure we are all seeing the same problem, does the attached > > patch fix your test? > > The problem of the random changes in sorting disappears for all libc > locales in pg_collati

Re: Inconsistent results with libc sorting on Windows

2023-06-09 Thread Daniel Verite
Juan José Santamaría Flecha wrote: > Just to make sure we are all seeing the same problem, does the attached > patch fix your test? The problem of the random changes in sorting disappears for all libc locales in pg_collation, so this is very promising. However it persists for the default

Re: Inconsistent results with libc sorting on Windows

2023-06-08 Thread Juan José Santamaría Flecha
> On 6/7/23 07:58, Daniel Verite wrote: > > Thomas Munro wrote: > > > >> > > Also, it does not occur at all if parallel scan is disabled. > >> > > >> > Could this be a clue that it is failing to be transitive? > >> > >> That vaguely rang a bell for me... and then I remembered this thread: >

Re: Inconsistent results with libc sorting on Windows

2023-06-07 Thread Joe Conway
On 6/7/23 07:58, Daniel Verite wrote: Thomas Munro wrote: > > Also, it does not occur at all if parallel scan is disabled. > > Could this be a clue that it is failing to be transitive? That vaguely rang a bell for me... and then I remembered this thread: https://www.postgresql.org/me

Re: Inconsistent results with libc sorting on Windows

2023-06-07 Thread Daniel Verite
Thomas Munro wrote: > > > Also, it does not occur at all if parallel scan is disabled. > > > > Could this be a clue that it is failing to be transitive? > > That vaguely rang a bell for me... and then I remembered this thread: > > https://www.postgresql.org/message-id/flat/2019120606340

Re: Inconsistent results with libc sorting on Windows

2023-06-05 Thread Thomas Munro
On Tue, Jun 6, 2023 at 1:30 PM Thomas Munro wrote: > On Tue, Jun 6, 2023 at 10:08 AM Daniel Verite wrote: > > Also, it does not occur at all if parallel scan is disabled. > > Could this be a clue that it is failing to be transitive? That vaguely rang a bell for me... and then I remembered this

Re: Inconsistent results with libc sorting on Windows

2023-06-05 Thread Thomas Munro
On Tue, Jun 6, 2023 at 10:08 AM Daniel Verite wrote: > Also, it does not occur at all if parallel scan is disabled. Could this be a clue that it is failing to be transitive?

Re: Inconsistent results with libc sorting on Windows

2023-06-05 Thread Joe Conway
On 6/5/23 18:07, Daniel Verite wrote: While trying pg16beta1 libc collations on Windows, I noticed that UTF-8 text sorts sometimes differently across invocations with the same locales, which is wrong since these collations are deterministic. Also, it does not occur at all if parallel scan is

Inconsistent results with libc sorting on Windows

2023-06-05 Thread Daniel Verite
Hi, While trying pg16beta1 libc collations on Windows, I noticed that UTF-8 text sorts sometimes differently across invocations with the same locales, which is wrong since these collations are deterministic. The OS is Windows 10 Home, version 10.0.19045 Build 19045, self-built 16beta1 with VS Com