For example, in MS-SQL, you can open up a query window and run the following:
DECLARE @List AS VARCHAR(8)
SELECT @List = 'foobar'
SELECT *
FROM dbo.PubLists
WHERE Name = @List
How is this done in PostgreSQL? Can it be done?
For example, in MS-SQL, you can open up a query window and run the following:
DECLARE @List AS VARCHAR(8)
SELECT @List = 'foobar'
SELECT *
FROM dbo.PubLists
WHERE Name = @List
How is this done in PostgreSQL? Can it be done?
For the official CLI client "psql" see here. And "pgAdmin3" 1.10 (still in beta) has "pgScript".
For use variables in for example alter table:
Here's an example of using a variable in plpgsql:
Have a look at the plpgsql docs for more information.