Re: proposal: variadic argument support for least, greatest function

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: variadic argument support for least, greatest function
Date: 2018-11-10 18:41:58
Message-ID: 87pnvcwzgl.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Vik" == Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> writes:

>> Attached patch add this possibility to least, greatest functions.

Vik> Is there any particular reason you didn't just make least and
Vik> greatest actual functions?

least() and greatest() have some type unification logic that I don't
think works for actual functions.

create function s(variadic anyarray) returns anyelement
language sql immutable
as $$ select min(v) from unnest($1) u(v); $$;

select s(1,2,3); -- works
select s(1,2,3.0); -- ERROR: function s(integer, integer, numeric) does not exist
select least(1,2,3.0); -- works

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-11-10 18:52:33 Re: proposal: variadic argument support for least, greatest function
Previous Message Vik Fearing 2018-11-10 18:12:54 Re: proposal: variadic argument support for least, greatest function