Re: Syntax for wildcard selection - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Syntax for wildcard selection
Date
Msg-id 20010816094531.A16062@svana.org
Whole thread Raw
In response to Syntax for wildcard selection  (Scott Holmes <sholmes@pacificnet.net>)
Responses Re: Syntax for wildcard selection  (Scott Holmes <scott@pacificnet.net>)
List pgsql-general
On Wed, Aug 15, 2001 at 04:06:16PM -0700, Scott Holmes wrote:
> This question just came up from a user use to our Informix application.  They
> tried to do a wildcard search, thus "where field_name LIKE 'AB%VN'".  The
> trailing values (after the %) are not recognized correctly.  With Informix
> 4GL, we wrote "where field_name MATCHES 'AB*VN'".  This finds any combination
> of values with 'AB' as the first two characters, and 'VN' as the last two,
> with any number of characters in between - including blanks.  How is this
> accomplished with PostgreSQL?  Are we limited to wildcard searches as "where
> field_name LIKE 'AB%'"?

The only thing I can think of is that you are using char() fields and the
like is getting confused by the trailing spaces. Certainly putting wildcards
anywhere in the string works fine.

What is the data type of your column? text and varchar() wouldn't suffer
from the above problem.
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.

pgsql-general by date:

Previous
From: Jason Turner
Date:
Subject: Re: Syntax for wildcard selection
Next
From: Bruce Momjian
Date:
Subject: Re: Syntax for wildcard selection