1
我想構建一個語句,動態構建語法以正確查詢postgres中的框數據類型。PostgreSQL:動態構建框數據類型的查詢
它看起來像下面這樣:
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: "'("
是否有可能建立這種類型的查詢動態?
請參閱答案Another similar StackOverflow question,其中顯示了您通常如何查詢箱數據類型。
替換' '' '(' || a.foo1 || '0, '|| a.foo1 ||',0) ''' )'帶'BOX(POINT(a.foo1,0),POINT(a.foo1,0))' – vette99