【问题标题】:How to add additional argument to call function inside function with json arguments in postgres如何在postgres中使用json参数在函数内部调用函数添加额外的参数
【发布时间】:2021-06-10 08:01:47
【问题描述】:

基本上我有child_function(arguments json)

在这个函数内部,我使用与child_function 完全相同的参数调用另一个函数:

select * from main_function(arguments)

但是我想在调用main_function() 时添加一些固定参数(例如'childFunction': true),可以吗?怎么做?

【问题讨论】:

    标签: json postgresql function parameters


    【解决方案1】:

    串联完成了这项工作:

    select * from main_function( (arguments::jsonb || '{"childFunction": true}'::jsonb)::json )
    

    【讨论】:

      猜你喜欢
      • 2015-08-27
      • 1970-01-01
      • 2013-06-23
      • 2021-10-17
      • 1970-01-01
      • 1970-01-01
      • 2022-06-30
      • 2021-11-09
      • 1970-01-01
      相关资源
      最近更新 更多