Re: Tightening isspace() tests where behavior should match SQL parser

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Tightening isspace() tests where behavior should match SQL parser
Date: 2017-06-09 18:36:32
Message-ID: 33cd5f6d-8d8a-b127-a6eb-90c09fb1f44f@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/24/17 15:34, Tom Lane wrote:
> I wrote:
>> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>>> +1 for back-patching. If I understand correctly, it would change the
>>> behavior when you pass a string with non-ASCII leading or trailing
>>> whitespace characters to those functions. I suppose that can happen, but
>>> it's only pure luck if the current code happens to work in that case.
>
>> Well, it'd work properly for e.g. no-break space in LATINn.
>
> Actually, it's dubious that treating no-break space as whitespace is
> correct at all in these use-cases. The core scanner would think it's
> an identifier character, so it's not impossible that somebody would
> consider it cute to write &nbsp; as part of a SQL identifier. If
> the core scanner accepts that, so must these functions.

The SQL standard might permit non-breaking spaces or similar things as
token delimiters, so it could be legitimate to look into changing that
sometime. But in any case it should be consistent, so it's correct to
make this change now.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Van Fleet 2017-06-09 18:39:35 HACKERS[PATCH] split ProcArrayLock into multiple parts
Previous Message Andrew Gierth 2017-06-09 18:27:46 Re: transition table behavior with inheritance appears broken