Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM5Fw-00042K-7v for pgsql-general@arkaria.postgresql.org; Thu, 02 May 2019 06:31:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hM5Fu-00028F-IQ for pgsql-general@arkaria.postgresql.org; Thu, 02 May 2019 06:31:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM5Fu-000286-31 for pgsql-general@lists.postgresql.org; Thu, 02 May 2019 06:31:42 +0000 Received: from smtp38.i.mail.ru ([94.100.177.98]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM5Fn-0004bm-4s for pgsql-general@postgresql.org; Thu, 02 May 2019 06:31:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=AQzbUwTGw2FjkQETC+s5fEAYj5l4OWYYKO3Cb9CxQ7A=; b=YfWmKM/h39BKwKssArkNW7JXWGfBsVQpi3kLhFdI+TTGv2q6t5FB66U9SQaxOp9gV2OJtWD6QAh3CGKqpt/BYGSN6lBz/mCYZNJoJiFoT7yz90gXSHZYI0sFBUF4wsJlAt9S53zrrAk9lBTAy41ocsYhsQ4AU9kVE19/UY1N1BQ=; Received: by smtp38.i.mail.ru with esmtpa (envelope-from ) id 1hM5Fl-0006ut-6N; Thu, 02 May 2019 09:31:33 +0300 Subject: Re: Upgrading locale issues To: Peter Geoghegan Cc: pgsql-general General References: From: rihad Message-ID: Date: Thu, 2 May 2019 10:31:30 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Authentication-Results: smtp38.i.mail.ru; auth=pass smtp.auth=rihad@mail.ru smtp.mailfrom=rihad@mail.ru X-77F55803: 260C666A7D66B36A5A78504BD2AC29419190768C267DA4DCB29848A37CEF0EAE5DC0D793D909C99E9E0B47E867E8D51C X-7FA49CB5: 0D63561A33F958A56B220BC245928875EDC4FF4471691A3D8286FD09DEB44F198941B15DA834481FA18204E546F3947CB861051D4BA689FCF6B57BC7E64490618DEB871D839B7333395957E7521B51C2545D4CF71C94A83E9FA2833FD35BB23D27C277FBC8AE2E8B3A703B70628EAD7BA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C22498CC5112E3E56BCDB3AA81AA40904B5D9CF19DD082D7633A093541453170D46FCD81D268191BDAD3D78DA827A17800CE7C8623B8F170C382FB3661434B16C20AC93541453170D46FCAAAE862A0553A39223F8577A6DFFEA7C43B0EB9F5DB130751624EFBBCDD7BCF7EFF80C71ABB335746BA297DBC24807EA27F269C8F02392CD20465B3A5AADEC6827F269C8F02392CD5571747095F342E88FB05168BE4CE3AF X-Mailru-Sender: B19AB4DAF1EA2FB5C00A13E8F74C9B2A24F831AC910C4326C9E61FED05C3C5FED3C3B9E8BF9E2370ABBFE0CF075BC50BFB559BB5D741EB96004FA9CEFBA991DA3A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 05/02/2019 12:26 AM, Peter Geoghegan wrote: > On Mon, Apr 29, 2019 at 7:45 AM rihad wrote: >> Hi. Today we run pg_ctl promote on a slave server (10.7) and started >> using it as a master. The OS also got upgraded FreeBSD 10.4 -> FreeBSD >> 11.2. And you guessed it, most varchar indexes got corrupted because >> system local changed in subtle ways. So I created the extension amcheck >> and reindexed all bad indexes one by one. Is there any way to prevent >> such things in the future? Will switching to ICU fix all such issues? > Not necessarily, but it will detect the incompatibility more or less > automatically, making it far more likely that the problem will be > caught before it does any harm. ICU versions collations, giving > Postgres a way to reason about their compatibility over time. The libc > collations are not versioned, though (at least not in any standard way > that Postgres can take advantage of). > >> The problem with it is that ICU collations are absent in pg_collation, >> initdb should be run to create them, but pg_basebackup only runs on an >> empty base directory, so I couldn't run initdb + pg_basebackup to >> prepare the replica server. I believe I can run the create collation >> command manually, but what would it look like for en-x-icu? > It is safe to call pg_import_system_collations() directly, which is > all that initdb does. This is documented, so you wouldn't be relying > on a hack. > Thanks for the reply. Do you know what would a "decent" ICU collation be to bind to a field's schema definition so it would mimic a UTF-8 encoding for a multilingual column? Maybe und-x-icu? We aren't as much concerned about their sortability in most cases, we just want indexes to better handle future PG/ICU upgrades. But what does und(efined) even mean with respect to collations? With UTF-8 at least some default collation is specified, like en_US.UTF-8. Will results be in a completely undefined order as a result of ORDER BY "icu_und_column"?