In Microsoft SQL Server, to test something like this in the query window:
select * from Users where LastName = @lastname
I can add this before the command:
declare @lastname varchar(16)
set @lastname = 'Troy'
But in PostgreSQL, I cannot find a similar way to do so. It seems the only thing I can do is to replace the parameter name directly with its value. It gets hard when the ad-hoc query gets complicated and the same parameter gets used several times. Is there a way?
I config postgres to log all the commands, and copy the command from the log file, so all the parameters are already replaced with the value, and test the command in the query window.
May not be the best approach, but it is easy and works for me