| From: | "Her Goo" <gu_he(at)msn(dot)com> |
|---|---|
| To: | <pgsql-sql(at)postgresql(dot)org> |
| Subject: | sql: "LIKE" problem |
| Date: | 2005-03-14 06:16:19 |
| Message-ID: | BAY11-DAV4899E308FCFAA7E626003F85560@phx.gbl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
I am using "postgresql-7.3.2-1" now!
I met a problem when using "LIKE" in "WHERE" clause.
For example, a table named "t_test", and its data looks like below:
# SELECT * FROM t_test;
id | c_name
----+--------
1 | abc\
2 | abc\de
(2 rows)
The thing I want to do is searching in above table and restricting
the results to those that begin with string "abc\". The search result is:
# SELECT * FROM t_test WHERE c_name LIKE 'abc\%';
id | c_name
----+--------
1 | abc\
2 | abc\de
(2 rows)
I want to go a step further, and restrict the results to those
that begin with string "abc\d". The search result is:
# SELECT * FROM t_test WHERE c_name LIKE 'abc\d%';
id | c_name
----+--------
(0 rows)
I don't know why the result is "0 rows"(why not is "1 rows"),
And I have trid "LIKE 'abc\\d%'", the result is also "0 rows".
Is this a bug for "postgresql-7.3.2-1" ?
Or how can I search a field when it contains a backslash('\') ?
Thanks!!!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-03-14 07:32:12 | Re: sql: "LIKE" problem |
| Previous Message | pginfo | 2005-03-14 06:01:26 | lower and unicode |