Wes James, 28.07.2010 19:35:
I'm trying to do this:
select * from table where field::text ilike '%\_%';
but it doesn't work.
How do you escape the _ and $ chars?
The docs say to use \, but that isn't working.
( http://www.postgresql.org/docs/8.3/static/functions-matching.html )
The text bet
Hey James,
Because in future releases the default value of the
"standard_conforming_strings"
parameter will change to "on" for improved standards compliance.
You should use string constants with C-Style escapes.
Please, see
http://www.postgresql.org/docs/8.4/static/sql-syntax-lexical.html#SQL-SYNT
On Wed, Jul 28, 2010 at 12:15 PM, Little, Douglas
wrote:
> Wes.
>
> You probably missed the part in bold. You need to double the backslash.
>
> select 'ab5c' like '%\_c'
>
> t
>
Why doesn't this work?
select * from table where field::text ilike '%\\\%'
WARNING: nonstandard use of \\ in a str
Thanks Douglas and Tom - I missed that second \.
-wes
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
Wes James writes:
> I'm trying to do this:
> select * from table where field::text ilike '%\_%';
> but it doesn't work.
You need to double the backslash, because one level of
backslash-escaping will be eaten by the string literal parser.
In the above example, the actual string value seen by ILIK
On Wed, Jul 28, 2010 at 12:47 PM, Justin Graf wrote:
> On 7/28/2010 12:35 PM, Wes James wrote:
>> I'm trying to do this:
>>
>> select * from table where field::text ilike '%\_%';
>>
>> but it doesn't work.
>>
>> How do you escape the _ and $ chars?
>>
>> The docs say to use \, but that isn't worki
On 7/28/2010 12:35 PM, Wes James wrote:
> I'm trying to do this:
>
> select * from table where field::text ilike '%\_%';
>
> but it doesn't work.
>
> How do you escape the _ and $ chars?
>
> The docs say to use \, but that isn't working.
>
> ( http://www.postgresql.org/docs/8.3/static/functions-mat
I'm trying to do this:
select * from table where field::text ilike '%\_%';
but it doesn't work.
How do you escape the _ and $ chars?
The docs say to use \, but that isn't working.
( http://www.postgresql.org/docs/8.3/static/functions-matching.html )
The text between '%...%' can be longer, I'm