Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D2ED4B5DBBD for ; Mon, 26 Sep 2011 07:52:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 64071-10 for ; Mon, 26 Sep 2011 10:52:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mail.postgresql.org (Postfix) with SMTP id 71C2BB5D95B for ; Mon, 26 Sep 2011 07:52:26 -0300 (ADT) Received: (qmail invoked by alias); 26 Sep 2011 10:52:25 -0000 Received: from fsgw.f-secure.com (EHLO [10.128.133.18]) [193.110.108.33] by mail.gmx.net (mp009) with SMTP; 26 Sep 2011 12:52:25 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX1+x7aoBHHuxkZ4QjzNB7butApU2HZz2ldb/Ces1Vy RghpQ5AdjSi915 Subject: Re: [v9.2] make_greater_string() does not return a string in some cases From: Peter Eisentraut To: Marcin =?UTF-8?Q?Ma=C5=84k?= Cc: Robert Haas , Tom Lane , Kyotaro HORIGUCHI , "pgsql-hackers@postgresql.org" In-Reply-To: <624360DC-C26A-4FA6-8C6A-26D28EA79422@gmail.com> References: <20110711.155531.15100243.horiguchi.kyotaro@oss.ntt.co.jp> <20110712.161231.138791411.horiguchi.kyotaro@oss.ntt.co.jp> <20110914.111320.18404009.horiguchi.kyotaro@oss.ntt.co.jp> <6425.1316656167@sss.pgh.pa.us> <8755.1316665444@sss.pgh.pa.us> <18434.1316702188@sss.pgh.pa.us> <24673.1316782288@sss.pgh.pa.us> <624360DC-C26A-4FA6-8C6A-26D28EA79422@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 26 Sep 2011 13:52:23 +0300 Message-ID: <1317034343.1759.13.camel@fsopti579.F-Secure.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.403 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/1355 X-Sequence-Number: 195544 On fre, 2011-09-23 at 20:35 +0300, Marcin Mańk wrote: > One idea: > col like 'foo%' could be translated to col >= 'foo' and col <= foo || 'zzz' , where 'z' is the largest possible character. This should be good enough for calculating stats. > > How to find such a character, i do not know. That's what makes this so difficult. If we knew the largest character, we could probably also find the largest-1, largest-2, etc. characters and determine the total order of everything.