Re: Seeking rows whit \

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Francisco Reyes" <lists(at)stringsutils(dot)com>
Cc: "PostgreSQL general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Seeking rows whit \
Date: 2008-05-19 02:48:47
Message-ID: 65937bea0805181948s24353eecnf5f3393f6e77e657@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, May 19, 2008 at 7:56 AM, Francisco Reyes <lists(at)stringsutils(dot)com>
wrote:

> Is there a way to search for rows with the character \?
>
> I tried variants of like and ~.
>
> create table mytable (f1 text);
> insert into mytable values ('Test row 1');
> insert into mytable values (E'Test row 2 \\');
>
> select * from mytable where f1 like E'%\\%'; <-- returned nothing
> select * from mytable where f1 ~ '\'; <-- waiting for single quote
> select * from mytable where f1 ~ E'\\'; <-- Error
>
> And a few more variants.. with no valid reults.
>
> Any suggestions?
>
>
>
It is well documented. Quoting from
http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#FUNCTIONS-LIKE

Thus, writing a pattern that actually matches a literal backslash means
writing four backslashes in the statement.

Best regards,
--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB http://www.enterprisedb.com

Mail sent from my BlackLaptop device

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2008-05-19 03:52:52 Re: Seeking rows whit \
Previous Message Francisco Reyes 2008-05-19 02:26:04 Seeking rows whit \