Re: Question on string value expression wildcarding

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Steve Wampler <swampler(at)noao(dot)edu>
Cc: postgres-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Question on string value expression wildcarding
Date: 2000-08-24 18:45:19
Message-ID: Pine.BSF.4.10.10008241142100.32930-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Do you have any odd locale settings or anything and what's
the table definition for the table in question?

It seems to do what I expect under my 7.0.2 system:

create table kp (name text);
insert into kp values ('kp.dhs.a');
insert into kp values ('kp.dhs.');
insert into kp values ('kp.dhs,d');
select * from kp where name like 'kp.dhs.%';
name
----------
kp.dhs.a
kp.dhs.
(2 rows)

select * from kp where name like 'kp.dhs%';
name
----------
kp.dhs.a
kp.dhs.
kp.dhs,d
(3 rows)

Stephan Szabo
sszabo(at)bigpanda(dot)com

On Thu, 24 Aug 2000, Steve Wampler wrote:

>
> I have LIKE expressions:
>
> (a) name LIKE 'kp.dhs.%'
> (b) name LIKE 'kp.dhs%'
>
> where the name column contains strings prefixed with "kp.dhs.".
>
> I'm using postgresql 7.0.2.
>
> Expression (a) fails to match any names while (b) matches
> all strings prefixed with "kp.dhs", including (as expected)
> those prefixed with "kp.dhs.".
>
> So I take it that ".%" has some special meaning in wildcarding,
> but my (limited) SQL references don't mention this case.
> Is this To Be Expected SQL behavior? If so, what
> expression can be used to match only strings prefixed with
> "kp.dhs."?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ryan Williams 2000-08-24 20:51:08 Re: weird structure
Previous Message rdg 2000-08-24 18:24:11 weird structure