Quoting columns with spaces in PostgreSQL? I migrated a database from SQL Server to PostgreSQL.

Most column names contain double words, for example:

SELECT [Column Name] FROM table;


...which does not work in PostgreSQL.

What is the correct syntax for PostgreSQL?
In most RDBMSs, double-quotes are what are used to specify an exact spelling of something..  (single quotes being string delimiters).

SELECT
  tab."This IS My Column EXACTLY" AS col
FROM "My TabLE Name Contains Spaces Too!" tab
WHERE tab."ANOTHER UGLY COLUMN name" = 'MyFilterString';


Notice that capital/lowercase also matters when using double-quotes.  (Postgres lower-cases everything when double-quotes are not used ... Oracle upper-cases everthing, etc..)

SELECT COLUMN1 FROM TABLE


in postgres, is different from

SELECT "COLUMN1" FROM TABLE


where as in oracle, is different from

SELECT "column1" FROM TABLE