【发布时间】:2012-09-28 14:50:10
【问题描述】:
我试图使用动态 SQL 在 postgres 中运行一些查询。
例子:
EXECUTE format('SELECT * from result_%s_table', quote_ident((select id from ids where condition = some_condition)))
我必须查询一个格式为 result_%s_table 的表,其中我需要从另一个表中替换正确的表名(一个 id)。
我收到错误ERROR: prepared statement "format" does not exist
【问题讨论】:
标签: postgresql dynamic-sql psql