Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id AF6BE633578 for ; Tue, 12 Jan 2010 20:45:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 28048-01 for ; Wed, 13 Jan 2010 00:45:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 9FA436328F9 for ; Tue, 12 Jan 2010 20:45:46 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o0D0jiwA029477; Tue, 12 Jan 2010 19:45:44 -0500 (EST) To: "Vee" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5273: Unexpected function behavior/failure In-reply-to: <201001122230.o0CMUWFS000320@wwwmaster.postgresql.org> References: <201001122230.o0CMUWFS000320@wwwmaster.postgresql.org> Comments: In-reply-to "Vee" message dated "Tue, 12 Jan 2010 22:30:32 +0000" Date: Tue, 12 Jan 2010 19:45:44 -0500 Message-ID: <29476.1263343544@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.458 tagged_above=-10 required=5 tests=AWL=0.141, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/104 X-Sequence-Number: 25608 "Vee" writes: > -- The problem query > select data, regexp_matches(data, '(h..l)') > from test; >> hello {hell} > Since I have no "where" clause, I would expect to see all the rows in the > result of the second case, with possibly a NULL value for the non-matched > rows. No. regexp_matches() returns setof something, meaning a row per match. When you have no match, you get no rows. And 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(). regards, tom lane