Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar
Date
Msg-id 19327.1371159841@sss.pgh.pa.us
Whole thread Raw
In response to BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar  (david.g.johnston@gmail.com)
List pgsql-bugs
David Johnston <david.g.johnston@gmail.com> 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

pgsql-bugs by date:

Previous
From: matt.s@aptalaska.com
Date:
Subject: BUG #8229: Dropuser and create user segfault for users in ldap
Next
From: David Johnston
Date:
Subject: Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar