【发布时间】:2019-11-28 14:47:56
【问题描述】:
有没有办法创建一个可以用可变数量的参数调用的函数(逗号分隔,所以位置)。 例如,使用 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...
不提供参数select * from idxi() 时有效,但仅提供一个时无效...
我哪里错了?
【问题讨论】:
标签: postgresql parameters stored-functions