Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdJxI-0006Jc-E6 for pgsql-sql@arkaria.postgresql.org; Tue, 27 Nov 2012 12:08:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TdJxG-0003mv-QA for pgsql-sql@arkaria.postgresql.org; Tue, 27 Nov 2012 12:07:58 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdJxF-0003mp-PB for pgsql-sql@postgresql.org; Tue, 27 Nov 2012 12:07:57 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdJxD-00060I-IG for pgsql-sql@postgresql.org; Tue, 27 Nov 2012 12:07:56 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TdJxI-0005OS-H4 for pgsql-sql@postgresql.org; Tue, 27 Nov 2012 13:08:00 +0100 Received: from 217.110.94.121 ([217.110.94.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Nov 2012 13:08:00 +0100 Received: from spam_eater by 217.110.94.121 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Nov 2012 13:08:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: Using regexp_matches in the WHERE clause Date: Tue, 27 Nov 2012 13:08:05 +0100 Lines: 39 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.121 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org > > 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 > > > Sounds to me like this: > > http://joecelkothesqlapprentice.blogspot.nl/2007/12/using-where-clause-parameter.html > Thanks, but my question is not related to the underlying problem. My question is: why I cannot use regexp_matches() in the WHERE clause, even when the result is clearly an integer value? 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