Using positional parameter ($1,..) in psql
问题 I often want to copy/paste sql out of my program code and test/debug in psql and it is tedious to have to replace positional arguments with literal values. Is there a good way to convert: select * from users where name=$1 and email=$2; to: select * from users where name='troy' and email='t@me.com'; 回答1: You could use psql variables. Those are interpolated in SQL code. Per documentation: A key feature of psql variables is that you can substitute ("interpolate") them into regular SQL statements