Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> Yeah. The given case is actually an invalid LIKE pattern. I wonder
>> whether we should make LIKE throw error for an invalid pattern.
> Yes, I think we should throw an error; the original query looked odd to
> me too.
A quick check in the standard supports the idea of throwing an error.
In fact, SQL92 saith
ii) If there is not a partitioning of the string P into sub-
strings such that each substring has length 1 or 2, no
substring of length 1 is the escape character E, and each
substring of length 2 is the escape character E followed by
either the escape character E, an <underscore> character,
or the <percent> character, then an exception condition is
raised: data exception-invalid escape sequence.
which not only requires E to not be the last character, but says that
it's a bug to escape anything but % _ or the escape character. That
last part is too anal for me, but it does seem we're on safe ground to
throw error for escape with nothing to escape. I'll go make it so.
regards, tom lane
In response to
pgsql-bugs by date
|Next:||From: Tom Lane||Date: 2008-09-26 03:31:17|
|Subject: Re: ERROR: unexpected data beyond EOF in block XXXXX of relation "file" |
|Previous:||From: austijc||Date: 2008-09-26 00:09:43|
|Subject: ERROR: unexpected data beyond EOF in block XXXXX of