我正在尝试使用来自程序命令的 Postgres 副本读取 JSON API。
当我打电话
copy _temp from program 'curl -uri "https://url"';
Run Code Online (Sandbox Code Playgroud)
它工作正常,但 API 有分页,我需要循环多次调用。
当我这样称呼它时:
_command := 'curl -uri "https://url?&page='||(10::text)||"';
copy _temp from program _command;`
Run Code Online (Sandbox Code Playgroud)
我得到
ERROR: syntax error at or near "_command"
Run Code Online (Sandbox Code Playgroud)
你甚至不能像
copy _temp from program 'curl -uri "https://url?&page='||(10::text)||'"';
Run Code Online (Sandbox Code Playgroud)
提高通知样式中的百分比参数替换也不起作用。
是什么赋予了?程序是带单引号的文字字符串,那么指定文字字符串和使用 text 或 varchar 变量有什么区别?似乎没有任何程序数据类型(::program cast 什么也不做),我错过了什么?
在文档中它说'最好使用固定的命令字符串'而不是你只能使用固定的命令字符串......
如何使用动态命令字符串?