From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | emilu(at)encs(dot)concordia(dot)ca |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: blank in query - cannot return results |
Date: | 2015-10-08 20:50:23 |
Message-ID: | CAKFQuwa6VAbnBR9+2zkrgkiJW=-O8k6CCYdEtMmXhjV8xGsXgw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Oct 8, 2015 at 3:54 PM, Emi <emilu(at)encs(dot)concordia(dot)ca> wrote:
> But run:
>> select * from table_name where col1 ilike '%Abc,%test%'; -- remove blank
>>
>> Result is returned.
>>
>
It works.
WITH vals (v) AS ( VALUES ('Abc, test'::text) )
SELECT *
FROM vals
WHERE v ILIKE '%Abc, test%'
If you are expecting a match and are not getting one that you need to look
at your data and figure out where you misunderstanding lies.
David J
P.S.
"
a percent sign (%) matches any sequence of zero or more characters
"
http://www.postgresql.org/docs/9.4/interactive/functions-matching.html#FUNCTIONS-POSIX-REGEXP
Removing the space and putting a "%" in in place simply means that the
space was optional, and since it now matches, is not present in the values
that appear in this query but not the one with an explicit space.
Note that there are different kinds of spaces...
From | Date | Subject | |
---|---|---|---|
Next Message | droberts | 2015-10-08 21:00:27 | Re: Best practices for aggregate table design |
Previous Message | Adrian Klaver | 2015-10-08 20:18:09 | Re: postgres standby won't start |