Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UnFJR-0001vt-PD for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Jun 2013 21:44:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UnFJR-0001xA-4l for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Jun 2013 21:44:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UnFJQ-0001x4-6L for pgsql-bugs@postgresql.org; Thu, 13 Jun 2013 21:44:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UnFJL-0001TB-AQ for pgsql-bugs@postgresql.org; Thu, 13 Jun 2013 21:44:07 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r5DLi17J019328; Thu, 13 Jun 2013 17:44:01 -0400 (EDT) From: Tom Lane To: David Johnston cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar In-reply-to: References: <16577.1371153742@sss.pgh.pa.us> Comments: In-reply-to David Johnston message dated "Thu, 13 Jun 2013 17:21:57 -0400" Date: Thu, 13 Jun 2013 17:44:01 -0400 Message-ID: <19327.1371159841@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org David Johnston writes: > The issue with the regexp_matches call generally is that absence of a "g" > modifier means that the set-returning function will never return a set. It > would seem to make more sense to not make that a modifier but instead have > one function defined to return a set (i.e., the current definition) and > another one defined to return a simply text[]. Well, it does return a set, namely either zero or one row. The point of the sub-SELECT workaround is to transform the zero-row case to a scalar NULL. I tend to agree that this API wasn't that well thought out, but it's really not regexp_matches()'s fault that you're running into this problem --- rather, it's the fact that one arm of the CASE can return a set while the other can't. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs