Thread: Who do I make _ not a wildcard?
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
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.
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, Pennsylvania19026