Single Quoted Aliases in SELECT - SQL Server to PostgreSQL Migration

SQL Server allows you to use single quoted column aliases in SELECT statements:

SQL Server:

  -- Using single quotes for aliases 'Current Datetime' and 'B' for two columns
  SELECT GETDATE() as 'Current Datetime', 'A' 'B'

In PostgreSQL you have to use double quoted aliases:


  -- Using double quotes for aliases "Current Datetime" and "B" for two columns
  SELECT NOW() as "Current Datetime", 'A' "B"

Both SQL Server and PostgreSQL queries return the same result:

Current Datetime B
2022-09-20 16:12:14.893 A

For more information, see SQL Server to PostgreSQL Migration.