在https://www.postgresql.org/docs/9.4/static/xfunc-sql.html上有例子:
create or replace function anyleast(variadic anyarray) returns anyelement as '
select min($1[i])from generate_subscripts($1,1)s(i)
' language sql;
commit;
eric=> select anyleast('abc'::text,'def');
anyleast
-----------
abc
(1 row)
但是当我这样做时,我得到了:
eric=> select anyleast('abc'::text,'def');
anyleast
-----------
{abc,def}
(1 row)