From: | Stefan 'Kaishakunin' Schumacher <stefan(at)net-tex(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Stefan 'Kaishakunin' Schumacher <stefan(at)net-tex(dot)de>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Array, ANY and Regular Expressions |
Date: | 2008-08-24 18:28:04 |
Message-ID: | 20080824182804.GC15905@bladerunner.kaishakunin.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Also sprach Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us)
> "Stefan 'Kaishakunin' Schumacher" <stefan(at)net-tex(dot)de> writes:
> > I have a table with an array column (tags text[]) which I want to
> > select from via ANY and RegExes.
>
> > SELECT tags from zettelkasten where 'Sozialpsychologie' ~* any(tags) order by
> > ident;
>
> Did you look at the matches? I suspect this isn't behaving even
> remotely the way you want, because ~* expects the pattern operand
> on the right.
Indeed, the results of ~* are not stable.
> Since there's no SQL syntax with ANY() on the left of the comparison
> operator, what you'd need to do to make this work is invent a "reverse
> regex" operator that switches its arguments. That'd be pretty trivial
> to do with a one-line plpgsql function under it. (I'm not sure what
> performance would be like though; as the table grows you might find
> yourself needing to change the reversing function to C.)
So there is no builtin way to do a regex search in Arrays?
mit freundlichen Grüßen
Stefan Schumacher
--
http://www.bildungswissenschaft.info
http://www.open-source-tag.de -- Magdeburger Open-Source-Tag
Entwicklung trifft Anwendung -- 11. Oktober 2008
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-08-24 21:22:12 | Re: psql \df+ [pattern] with overloaded functions |
Previous Message | Alban Hertroys | 2008-08-24 11:54:52 | Re: SERIAL datatype |