pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Question on string value expression wildcarding
2+ messages / 2 participants
[nested] [flat]

* Question on string value expression wildcarding
@ 2000-08-24 18:15  Steve Wampler <swampler@noao.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Steve Wampler @ 2000-08-24 18:15 UTC (permalink / raw)
  To: pgsql-sql


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."?

Thanks!
--
Steve Wampler-  SOLIS Project, National Solar Observatory
swampler@noao.edu



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Question on string value expression wildcarding
@ 2000-08-24 18:45  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Steve Wampler <swampler@noao.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2000-08-24 18:45 UTC (permalink / raw)
  To: Steve Wampler <swampler@noao.edu>; +Cc: 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@bigpanda.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."?




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-08-24 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-24 18:15 Question on string value expression wildcarding Steve Wampler <swampler@noao.edu>
2000-08-24 18:45 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox