I use variable in psql like: \set user_id 10;
When i want use this variable in query like select * from users where user_id = :user_id;
- it's ok
But when i use this for ltree column i have a problem select * from accounts where customer_id <@ :user_id
?
Can you help me?
CodePudding user response:
You need a string literal, so you have to quote the value:
select * from accounts where customer_id <@ :'user_id';
That will become
select * from accounts where customer_id <@ '10';