Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceETb-0004XY-8R for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Feb 2017 05:19:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ceETZ-00018a-Uz for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Feb 2017 05:19:29 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ceESA-0007o5-99 for pgsql-hackers@postgresql.org; Thu, 16 Feb 2017 05:18:02 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ceES3-0008Lz-IH for pgsql-hackers@postgresql.org; Thu, 16 Feb 2017 05:18:00 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C643520A8E; Thu, 16 Feb 2017 00:17:54 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 16 Feb 2017 00:17:54 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=/RsMw1C6FtGLmyFP2DEmbmttQA0=; b=inlkVMrvEL7m3ufe/Olf 36+QQZ1M30YnPjz1W1pyzmQDqKnjL/E+AThqAGRdQZVb5BUTrn5sq6i6DtcEHOfp Cr3fezsAMjQjNQmfNqO8LNasAyI67C8/g+sE8x3q1JDDZQLQYmmlAPltPS3R760p z6PzwX92P7nt5LX8GgHHMhE= X-ME-Sender: X-Sasl-enc: e2rr4fnxTfH5396nik4bS+wSgfkle04k5VaprKg1CkZI 1487222274 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 82BE924077; Thu, 16 Feb 2017 00:17:54 -0500 (EST) Subject: Re: ICU integration To: Thomas Munro , Peter Geoghegan References: <85364fde-091f-bbc0-fec2-e3ede39840a6@2ndquadrant.com> <3a88fa29-275b-f547-9957-86d4b2cd68db@2ndquadrant.com> Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Thu, 16 Feb 2017 00:17:53 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 1/31/17 16:59, Thomas Munro wrote: > I assume (but haven't checked) that ucol_nextSortKeyPart accesses only > the start of the string via the UCharIterator passed in, unless you > have the rare reverse-accent-sort feature enabled (maybe used only in > fr_CA, it looks like it is required to scan the whole string looking > for the last accent). So I assume that uiter_setUTF8 and > ucol_nextSortKeyPart would usually do a small fixed amount of work, > whereas this patch's icu_to_uchar allocates space and converts the > whole variable length string every time. I have changed it to use ucol_nextSortKeyPart() when appropriate. > That's about abbreviation, but I note that you can also compare > strings using iterators with ucol_strcollIter, avoiding the need to > allocate and transcode up front. I have no idea whether that'd pay > off. These iterators don't actually transcode on the fly. You can only set up iterators for UTF-8 or UTF-16 strings. And for UTF-8, we already have a special code path using ucol_strcollUTF8(), which uses an interator internally. > Clearly when you upgrade your system from (say) Debian 8 to Debian 9 > and the ICU major version changes we expect to have to REINDEX, but > does anyone know if such data changes are ever pulled into the minor > version package upgrades you get from regular apt-get update of (say) > a Debian 8 or CentOS 7 or FreeBSD 11 system? In other words, do we > expect collversion changes to happen basically any time in response to > regular system updates, or only when you're doing a major upgrade of > some kind, as the above-quoted documentation patch implies? Stable operating systems shouldn't do major library upgrades, so I feel pretty confident about this. > > + collversion = ntohl(*((uint32 *) versioninfo)); > > UVersionInfo is an array of four uint8_t. That doesn't sound like > something that needs to be bit-swizzled... is it really? Even if it > is arranged differently on different architectures, I'm not sure why > you care since we only ever use it to compare for equality on the same > system. But aside from that, I don't love this cast to uint32. I > wonder if we should use u_versionToString to respect boundaries a bit > better? Makes sense, changed the column type to text. > I have another motivation for wanting to model collation versions as > strings: I have been contemplating a version check for system-provided > collations too, piggy-backing on your work here. Obviously PostgreSQL > can't directly know anything about system collation versions, but I'm > thinking of a GUC system_collation_version_command which you could > optionally set to a script that knows how to inspect the local > operating system. For example, a package maintainer might be > interested in writing such a script that knows how to ask the package > system for a locale data version. A brute force approach that works > on many systems could be 'tar c /usr/share/local/*/LC_COLLATE | md5'. That sounds like an idea worth pursuing. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers