Postgresql 一个不适合我的变量函数示例
下面是一个例子:Postgresql 一个不适合我的变量函数示例,postgresql,Postgresql,下面是一个例子: 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)
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)
当您执行
\sf至少时,您看到了什么?…它在这里起作用。@VaoTsun可能想说的是,search\u path
中可能还有另一个anyleast
函数。是-完全正确,或者在具有两个文本参数的同一架构中,例如create或replace function anyleast(a text,b text)将表(a text[])返回为“select array[a,b]”语言sql代码>难以置信!是的,就是这样!谢谢你们两位!