相关疑难解决方法(0)

postgres中的动态sql查询

我试图使用动态SQL在postgres中运行一些查询.

例:

EXECUTE format('SELECT * from result_%s_table', quote_ident((select id from ids where condition = some_condition)))
Run Code Online (Sandbox Code Playgroud)

我必须查询一个表,其格式为result_%s_table,其中,我需要用另一个表替换正确的表名(一个id).

我收到了错误 ERROR: prepared statement "format" does not exist

链接:使用查询结果postgresql进行字符串替换

postgresql dynamic-sql psql

20
推荐指数
3
解决办法
5万
查看次数

标签 统计

dynamic-sql ×1

postgresql ×1

psql ×1