Re: [v9.2] make_greater_string() does not return a string in some cases

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] make_greater_string() does not return a string in some cases
Date: 2011-09-23 12:51:28
Message-ID: 24673.1316782288@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Sep 22, 2011 at 10:36 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Anyway, I won't stand in the way of the patch as long as it's modified
>> to limit the number of values considered for any one character position
>> to something reasonably small.

> I think that limit in both the old and new code is 1, except that the
> new code does it more efficiently.

> Am I confused?

Yes, or else I am. Consider a 4-byte UTF8 character at the end of the
string. The existing code increments the last byte up to 255 (rejecting
everything past 0xBF), then gives up and truncates that character away.
So the maximum number of tries for that character position is between 0
and 127 depending on what the original character was (with at most 63 of
the incremented values getting past the verifymbstr test).

The proposed patch is going to iterate through all Unicode code points
up to U+7FFFFF before giving up. Since it's possible that we need to
increment something further left to succeed at all, this doesn't seem
like a good plan.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-09-23 12:56:48 Re: Re: [BUGS] BUG #6189: libpq: sslmode=require verifies server certificate if root.crt is present
Previous Message Robert Haas 2011-09-23 12:49:25 Re: Re: [BUGS] BUG #6189: libpq: sslmode=require verifies server certificate if root.crt is present

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-09-23 12:54:54 Re: Hot Backup with rsync fails at pg_clog if under load
Previous Message Robert Haas 2011-09-23 12:49:25 Re: Re: [BUGS] BUG #6189: libpq: sslmode=require verifies server certificate if root.crt is present