I am trying to construct a statement that dynamically builds the syntax to properly query a box data type in postgres.
It looks something like the following:
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;
The above query yields: ERROR: invalid input syntax for type box: "'("
Is it possible to build this type of query dynamically?
See the answer Another similar StackOverflow question that shows how you would normally query the box data type.