【发布时间】:2019-11-01 10:47:35
【问题描述】:
作为 ETL 过程的一部分,我正在尝试更改递归函数的架构。喜欢
CREATE FUNCTION some_recursive()
RETURNS some_type
LANGUAGE sql
AS $function$
-- do stuff
some_recursive()
--do more
$function$
;
我这样做是用
ALTER FUNCTION some_recursive() SET SCHEMA new_schema
这会正确更新,例如依赖视图,将它们从调用some_recursive() 更改为new_schema.some_recursive()。但是递归本身(在函数体内)没有更新,所以当函数被调用时,它会失败。
IE。函数定义后架构更改如下所示:
CREATE FUNCTION new_schema.some_recursive()
RETURNS some_type
LANGUAGE sql
AS $function$
-- do stuff
-- note the next line (no new_schema.-prefix)
some_recursive()
--do more
$function$
;
有没有办法改变递归函数的架构?
如果做不到这一点,我也许可以让功能维护者更改其实现。 有没有办法让函数调用类似“self”的东西(即隐式而不指定自己的名称)?
【问题讨论】:
标签: postgresql etl data-warehouse