From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar
Date: Thu, 13 Jun 2013 17:44:01 -0400
Message-ID: <19327.1371159841@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbwakNTQ0xyVjphNkco7MSuSVGe1j_1uBQnpt9s3iY33Q@mail.gmail.com>
References: <E1UnCv4-0007oF-Bo@wrigleys.postgresql.org>
<16577.1371153742@sss.pgh.pa.us>
<CAKFQuwbwakNTQ0xyVjphNkco7MSuSVGe1j_1uBQnpt9s3iY33Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com
Subject: Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar
In-Reply-To: <19327.1371159841@sss.pgh.pa.us>
References: <E1UnCv4-0007oF-Bo@wrigleys.postgresql.org> <16577.1371153742@sss.pgh.pa.us> <CAKFQuwbwakNTQ0xyVjphNkco7MSuSVGe1j_1uBQnpt9s3iY33Q@mail.gmail.com> <19327.1371159841@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox