Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D9C8B633F07 for ; Tue, 12 Jan 2010 21:48:50 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 34774-01 for ; Wed, 13 Jan 2010 01:48:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153]) by mail.postgresql.org (Postfix) with ESMTP id 75033633EFB for ; Tue, 12 Jan 2010 21:48:39 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id 19so9621247fgg.1 for ; Tue, 12 Jan 2010 17:48:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=a+4MWxSOiLzGGLsowxCThbbJ1rJOUkM8rjbL0yXBFuA=; b=qX5xzokJn6r5fpW43r0m3CBKW1WDNkrEi2rAl9ekXwWurOhUBV7+6XhJTplts+fgzi wSD/GpsLSbUhjn8c7KaVqHfFJ7zm9092nvR5oT7MyHRj6xdoQkwwDIwS2hzJ7naTEgRI ewD+/3e4zok+5cHuzY9C9R6MW82wDNiEEwkqY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=SWCkIUPEtH6Qw3fy1vWMH3ibA4ZdqJ2HkVDzqgDmxTSrP1Ml01IQDjgCqnThqxd/JV n4Jjx3sntTPR/iaGoJqxw1zpX5cNCOqQdUDqCfSbmzS52gBsDX1pNtjudLpOtFiRVJgs cjVZev4Vfqql4BiuVRFYsmvV1TKv762IGbOQw= MIME-Version: 1.0 Received: by 10.239.135.78 with SMTP id c14mr10654hbc.9.1263347316904; Tue, 12 Jan 2010 17:48:36 -0800 (PST) In-Reply-To: <29476.1263343544@sss.pgh.pa.us> References: <201001122230.o0CMUWFS000320@wwwmaster.postgresql.org> <29476.1263343544@sss.pgh.pa.us> Date: Tue, 12 Jan 2010 20:48:36 -0500 Message-ID: <603c8f071001121748u1dd53f7ai2fe60a310d500019@mail.gmail.com> Subject: Re: BUG #5273: Unexpected function behavior/failure From: Robert Haas To: Tom Lane Cc: Vee , pgsql-bugs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/105 X-Sequence-Number: 25609 On Tue, Jan 12, 2010 at 7:45 PM, Tom Lane wrote: > "Vee" writes: >> -- The problem query >> select data, regexp_matches(data, '(h..l)') >> from test; > >>> hello =A0 =A0 =A0 =A0{hell} > >> Since I have no "where" clause, I would expect to see all the rows in th= e >> result of the second case, with possibly a NULL value for the non-matche= d >> rows. > > No. =A0regexp_matches() returns setof something, meaning a row per match. > When you have no match, you get no rows. =A0And that in turn means that > the calling select produces no rows --- just as it could also produce > more than one row from a given table row. > > I think the behavior you are after is probably more like that of > substring(). Or maybe the ~ operator. ...Robert