pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Who do I make _ not a wildcard?
3+ messages / 3 participants
[nested] [flat]

* Who do I make _ not a wildcard?
@ 2001-07-28 18:12  Roy Souther <roy@silicontao.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Roy Souther @ 2001-07-28 18:12 UTC (permalink / raw)
  To: pgsql-sql

In PG the _ is a wildcard that means any singal char. I need to do a search 
for the actual _ char and not get back thousands of wrong matches. Is there 
and escape char that I could use? This needs to work with PG 7.0.3 & 7.1.2.

TIA
-- 
Roy Souther <roy@silicontao.com>

01100010 10101110 11000110 11010110 00000100 10110010 10010110 11000110 
01001110 11110110 11001110 00010110 10010110 00101110 10000100 10000100 




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Who do I make _ not a wildcard?
@ 2001-07-28 19:18  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Roy Souther <roy@silicontao.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Stephan Szabo @ 2001-07-28 19:18 UTC (permalink / raw)
  To: Roy Souther <roy@silicontao.com>; +Cc: pgsql-sql

On Sat, 28 Jul 2001, Roy Souther wrote:

> In PG the _ is a wildcard that means any singal char. I need to do a search 
> for the actual _ char and not get back thousands of wrong matches. Is there 
> and escape char that I could use? This needs to work with PG 7.0.3 & 7.1.2.

\\_ should work for a literal escape.
At least on current sources you can do something like:
 like 'blah!_%' escape '!'
where ! becomes the escape character for the string.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Who do I make _ not a wildcard?
@ 2001-07-30 03:38  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2001-07-30 03:38 UTC (permalink / raw)
  To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: Roy Souther <roy@silicontao.com>; pgsql-sql


I also think two underscores make a literal underscore.  Same with %.

> On Sat, 28 Jul 2001, Roy Souther wrote:
> 
> > In PG the _ is a wildcard that means any singal char. I need to do a search 
> > for the actual _ char and not get back thousands of wrong matches. Is there 
> > and escape char that I could use? This needs to work with PG 7.0.3 & 7.1.2.
> 
> \\_ should work for a literal escape.
> At least on current sources you can do something like:
>  like 'blah!_%' escape '!'
> where ! becomes the escape character for the string.
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-07-30 03:38 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-28 18:12 Who do I make _ not a wildcard? Roy Souther <roy@silicontao.com>
2001-07-28 19:18 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-07-30 03:38   ` Bruce Momjian <pgman@candle.pha.pa.us>

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