From: Tom Lane <tgl@sss.pgh.pa.us>
To: d.rericha@healthcareoss.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6314: The like command does not handle a long string of special chars
Date: Thu, 01 Dec 2011 13:08:01 -0500
Message-ID: <8577.1322762881@sss.pgh.pa.us> (raw)
In-Reply-To: <E1RWAcS-0007Qi-OD@wrigleys.postgresql.org>
References: <E1RWAcS-0007Qi-OD@wrigleys.postgresql.org>
d.rericha@healthcareoss.com writes:
> Simply set a varchar field in your db to the following string:
> !"#$%'()*+,-/:;=?@[\]^_`{|}~0000&<>
> I know, I know, who would do this, right? Well, its for a certification.
> The like command works fine up with escapes up to:
> !"#$%''()*+,-/:;=?@[%
Doesn't match for me, rather unsurprisingly since this string contains
two occurrences of "'" not one.
> Notice, I added the % to the end. However, if you go any further - no
> matches:
> !"#$%''()*+,-/:;=?@[\\%
> Strangely, this works and shouldn't:
> !"#$%''()*+,-/:;=?@[\%
It's hard to tell for sure, since you've presented a garbled
interpretation of what you did rather than showing us exactly what you
did, but I'm suspecting the problem boils down to forgetting that
backslash is an escape character in Postgres string literals, and
also for LIKE itself. You should reread the manual's discussion of
LIKE:
http://www.postgresql.org/docs/8.4/static/functions-matching.html
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, d.rericha@healthcareoss.com
Subject: Re: BUG #6314: The like command does not handle a long string of special chars
In-Reply-To: <8577.1322762881@sss.pgh.pa.us>
References: <E1RWAcS-0007Qi-OD@wrigleys.postgresql.org> <8577.1322762881@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox