有没有办法创建一个可以用可变数量的参数调用的函数(逗号分隔,所以位置)。例如,使用 function1(param1,param2) 调用此类函数并可能使用 function1(,param2) 或 function1(param1,) 调用它?我创建了一个带有默认参数的函数,但调用它时出错:
select * from iDxi('3 days',) order by "Date" asc
ERROR: syntax error at or near ")"
LINE 1: select * from iDxi('3 days',) order by "Date" asc
我的函数定义如下:
CREATE OR REPLACE FUNCTION public.idxi(
mydated text DEFAULT '99 year'::text,
mydatef text DEFAULT '-99 year'::text)
RETURNS TABLE...
它在不提供 argsselect * from idxi()时有效,但在仅提供一个时无效......
我哪里错了?