Skip site navigation (1) Skip section navigation (2)

Question on string value expression wildcarding

From: Steve Wampler <swampler(at)noao(dot)edu>
To: postgres-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Question on string value expression wildcarding
Date: 2000-08-24 18:15:42
Message-ID: 39A5664E.CC23534C@noao.edu (view raw or flat)
Thread:
Lists: 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(at)noao(dot)edu

Responses

pgsql-sql by date

Next:From: rdgDate: 2000-08-24 18:24:11
Subject: weird structure
Previous:From: Ingram, BryanDate: 2000-08-24 17:16:49
Subject: Is there a way to tell if db has changed?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group