Re: BUG #6314: The like command does not handle a long string of special chars

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <d(dot)rericha(at)healthcareoss(dot)com>,<pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6314: The like command does not handle a long string of special chars
Date: 2011-12-01 18:05:19
Message-ID: 4ED76D7F0200002500043704@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<d(dot)rericha(at)healthcareoss(dot)com> wrote:

> Simply set a varchar field in your db to the following string:
> !&quot;#$%&#39;()*+,-/:;=?(at)[\]^_`{|}~0000&amp;&lt;&gt;

Do you have standard_conforming_strings = on?

> The like command works fine up with escapes up to:
> !&quot;#$%&#39;&#39;()*+,-/:;=?(at)[%
> Notice, I added the % to the end. However, if you go any further -
> no matches:
> !&quot;#$%&#39;&#39;()*+,-/:;=?(at)[\\%
> Strangely, this works and shouldn&#39;t:
> !&quot;#$%&#39;&#39;()*+,-/:;=?(at)[\%

It is always better to include a self-contained test case. For
example:

test=# set standard_conforming_strings = on;
SET
test=# create table t (v text not null);
CREATE TABLE
test=# insert into t values
('!&quot;#$%&#39;()*+,-/:;=?(at)[\]^_`{|}~0000&amp;&lt;&gt;');
INSERT 0 1
test=# select * from t where v like
'!&quot;#$\%&#39;()*+,-/:;=?(at)[\\]^_`{|}~0000&amp;&lt;&gt%'
escape '\';
v
--------------------------------------------------------
!&quot;#$%&#39;()*+,-/:;=?(at)[\]^_`{|}~0000&amp;&lt;&gt;
(1 row)

So this is not a bug on HEAD. What do you get when you run it?

-Kevin

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-12-01 18:08:01 Re: BUG #6314: The like command does not handle a long string of special chars
Previous Message Tom Lane 2011-12-01 17:53:56 Re: 9.1.1 hot standby startup gets sigbus