我正在尝试构建一个动态构建语法以正确查询 postgres 中的框数据类型的语句。
它看起来像下面这样:
Note: foo1 is an integer value
with a as (
select foo1 from foo where id = 1),
b as (
select a, b, c from bar where a && '''('||a.foo1||',0,'||a.foo1||',0)''')
select * from b;
上面的查询产生:ERROR: invalid input syntax for type box: "'("
是否可以动态构建这种类型的查询?
查看答案另一个类似的 StackOverflow 问题,显示您通常如何查询框数据类型。