Postgres Set Variable In T Sql Replace Function