Unix Technical Forum

list or regular expressions

This is a discussion on list or regular expressions within the Pgsql General forums, part of the PostgreSQL category; --> Hi all, can i search in a list or regular expression....eg "select yadi from ya where yadiya in ('old', ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 11:22 AM
Rhys Stewart
 
Posts: n/a
Default list or regular expressions

Hi all,
can i search in a list or regular expression....eg

"select yadi from ya where yadiya in ('old', 'ulk', 'orb')"

but instead of in ther'd be another operator or a LIKE IN.
so it'd be a shorcut for typing yadiya ~* 'old' or yadiya ~* 'ulk' etc.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 11:22 AM
Tom Lane
 
Posts: n/a
Default Re: list or regular expressions

"Rhys Stewart" <rhys.stewart@gmail.com> writes:
> can i search in a list or regular expression....eg


> "select yadi from ya where yadiya in ('old', 'ulk', 'orb')"


> but instead of in ther'd be another operator or a LIKE IN.


You could use "<operator> ANY" --- "IN" is just a shorthand for "= ANY".
I don't think the parser will take LIKE ANY, but you could use the
equivalent operator name ("~~" I think, check the manual).

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 11:22 AM
Mischa Sandberg
 
Posts: n/a
Default Re: list or regular expressions

Rhys Stewart wrote:
> Hi all,
> can i search in a list or regular expression....eg
>
> "select yadi from ya where yadiya in ('old', 'ulk', 'orb')"
>
> but instead of in ther'd be another operator or a LIKE IN.
> so it'd be a shorcut for typing yadiya ~* 'old' or yadiya ~* 'ulk' etc.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>


you mean, like

yadiya ~ 'old|ulk'

(or parametrically)

yadiya ~ ?::text ||'|'|| ?::text ||'|'|| ... :-)

--
Engineers think that equations approximate reality.
Physicists think that reality approximates the equations.
Mathematicians never make the connection.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com