pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #7835: The _ acts like a wildcard when used as '%_%'
2+ messages / 2 participants
[nested] [flat]
* BUG #7835: The _ acts like a wildcard when used as '%_%'
@ 2013-01-29 17:20 elliott.groszek@navy.mil
2013-01-29 18:14 ` Re: BUG #7835: The _ acts like a wildcard when used as '%_%' Jaime Casanova <jaime@2ndquadrant.com>
0 siblings, 1 reply; 2+ messages in thread
From: elliott.groszek@navy.mil @ 2013-01-29 17:20 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 7835
Logged by: Elliott Groszek
Email address: elliott.groszek@navy.mil
PostgreSQL version: 9.0.11
Operating system: Linux
Description:
Using the _ (underscore) in a wildcard query accesses values with - (dash)
as well. This results in unexpected behaviors when some data values contain
the underscore and some data values contain the dash.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #7835: The _ acts like a wildcard when used as '%_%'
2013-01-29 17:20 BUG #7835: The _ acts like a wildcard when used as '%_%' elliott.groszek@navy.mil
@ 2013-01-29 18:14 ` Jaime Casanova <jaime@2ndquadrant.com>
0 siblings, 0 replies; 2+ messages in thread
From: Jaime Casanova @ 2013-01-29 18:14 UTC (permalink / raw)
To: elliott.groszek@navy.mil; +Cc: pgsql-bugs
On Tue, Jan 29, 2013 at 12:20 PM, <elliott.groszek@navy.mil> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 7835
> Logged by: Elliott Groszek
> Email address: elliott.groszek@navy.mil
> PostgreSQL version: 9.0.11
> Operating system: Linux
> Description:
>
> Using the _ (underscore) in a wildcard query accesses values with - (dash)
> as well. This results in unexpected behaviors when some data values contain
> the underscore and some data values contain the dash.
>
i guess you are using a LIKE expression. And in like both % and _ are
wildcards, as documented in:
http://www.postgresql.org/docs/9.2/static/functions-matching.html#FUNCTIONS-LIKE
And AFAIU, mandated by SQL Standard
"An underscore (_) in pattern stands for (matches) any single
character; a percent sign (%) matches any sequence of zero or more
characters."
if you only want to show those that contains an underscore (supressing
its wildcard behaviour) you need to use a escape character:
col LIKE '%\_%'
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Phone: +593 4 5107566 Cell: +593 987171157
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-01-29 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 17:20 BUG #7835: The _ acts like a wildcard when used as '%_%' elliott.groszek@navy.mil
2013-01-29 18:14 ` Jaime Casanova <jaime@2ndquadrant.com>
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