pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard van der Hoff <richard@matrix.org>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Inexplicable duplicate rows with unique constraint
Date: Thu, 16 Jan 2020 12:48:06 -0500
Message-ID: <3248.1579196886@sss.pgh.pa.us> (raw)
In-Reply-To: <aa5a565d-15f9-c44a-fd34-1fff814b0c51@matrix.org>
References: <288488b7-d3b6-905b-3706-43f7a3c7bc52@matrix.org>
	<1605.1579194518@sss.pgh.pa.us>
	<CABUevEwqyQeFKJbucVTjcchsxeq=eZ+AAsSWi8WKf8HM-EVQoQ@mail.gmail.com>
	<aa5a565d-15f9-c44a-fd34-1fff814b0c51@matrix.org>

Richard van der Hoff <richard@matrix.org> writes:
> On 16/01/2020 17:12, Magnus Hagander wrote:
>> See https://wiki.postgresql.org/wiki/Locale_data_changes for hints on
>> which linux distros updated when.

> It seems like a plausible explanation but it's worth noting that all the 
> indexed data here is (despite being in text columns), plain ascii. I'm 
> surprised that a change in collation rules would change the sorting of 
> such strings, and hence that it could lead to this problem. Am I naive?

Unfortunately, strings containing punctuation do sort differently
after these changes, even with all-ASCII data.  The example given
on that wiki page demonstrates this.

RHEL6 (old glibc):

$ ( echo "1-1"; echo "11" ) | LC_COLLATE=en_US.utf8 sort
11
1-1

Fedora 30 (new glibc):

$ ( echo "1-1"; echo "11" ) | LC_COLLATE=en_US.utf8 sort
1-1
11

I concur with Daniel's suggestion that maybe "C" locale is
the thing to use for this data.

			regards, tom lane





view thread (14+ messages)  latest in thread

Message-ID: <3248.1579196886@sss.pgh.pa.us>
Permalink:  ../3248.1579196886@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3248.1579196886@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, richard@matrix.org
  Subject: Re: Inexplicable duplicate rows with unique constraint
  In-Reply-To: <3248.1579196886@sss.pgh.pa.us>
  References: <288488b7-d3b6-905b-3706-43f7a3c7bc52@matrix.org> <1605.1579194518@sss.pgh.pa.us> <CABUevEwqyQeFKJbucVTjcchsxeq=eZ+AAsSWi8WKf8HM-EVQoQ@mail.gmail.com> <aa5a565d-15f9-c44a-fd34-1fff814b0c51@matrix.org> <3248.1579196886@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox