I am using PostgreSQL to create complexe dynamic queries. In my queries I can use one variable multiple times in multiple positions in the query, to simplify things, I want to know if I can do something like this :
SELECT * FROM employees Where name = $1 and id = $2 and manager_id = $2;
And then execute the query like this :
EXECUTE format ('SELECT * FROM employees Where name = $1 and id = $2 and manager_id = $2;') using (var_name, var_id);