Postgres Set Variable In T Sql If Statement