pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Willem Leenen <willem_leenen@hotmail.com>
To: spam_eater@gmx.net
To: pgsql-sql@postgresql.org
Subject: Re: Using regexp_matches in the WHERE clause
Date: Tue, 27 Nov 2012 11:44:24 +0000
Message-ID: <DUB104-W30ACC9F07483AD6B500D698F5E0@phx.gbl> (raw)
In-Reply-To: <k8vmbm$1fg$1@ger.gmane.org>
References: <k8vmbm$1fg$1@ger.gmane.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Sounds to me like this:
http://joecelkothesqlapprentice.blogspot.nl/2007/12/using-where-clause-parameter.html
> To: pgsql-sql@postgresql.org
> From: spam_eater@gmx.net
> Subject: [SQL] Using regexp_matches in the WHERE clause
> Date: Mon, 26 Nov 2012 13:13:06 +0100
>
> Hi,
>
> I stumbled over this question on Stackoverflow
>
> http://stackoverflow.com/questions/13564369/postgresql-using-column-data-as-pattern-for-regexp-match
>
> And my initial reaction was, that this should be possible using regexp_matches.
>
> So I tried:
>
> SELECT *
> FROM some_table
> WHERE regexp_matches(somecol, 'foobar') is not null;
>
> However that resulted in: ERROR: argument of WHERE must not return a set
>
> Hmm, even though an array is not a set I can partly see what the problem is
> (although given the really cool array implementation in PostgreSQL I was a bit surprised).
>
>
> So I though, if I convert this to an integer, it should work:
>
> SELECT *
> FROM some_table
> WHERE array_length(regexp_matches(somecol, 'foobar'), 1) > 0
>
> but that still results in the same error.
>
> But array_length() clearly returns an integer, so why does it still throw this error?
>
>
> I'm using 9.2.1
>
> Regards
> Thomas
>
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
=
view thread (9+ messages) latest in thread
Message-ID: <DUB104-W30ACC9F07483AD6B500D698F5E0@phx.gbl>
Permalink: ../DUB104-W30ACC9F07483AD6B500D698F5E0@phx.gbl/
Also on: postgresql.org/message-id/DUB104-W30ACC9F07483AD6B500D698F5E0@phx.gbl
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: willem_leenen@hotmail.com, spam_eater@gmx.net
Subject: Re: Using regexp_matches in the WHERE clause
In-Reply-To: <DUB104-W30ACC9F07483AD6B500D698F5E0@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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