0

Every time I try to write out

SELECT ID, att_id AS 'Attribute ID'
FROM Table

it says

ERROR: syntax error at or near 'Attribute ID'.

How can I use the AS ' ' function in postgresql?

jarlh
  • 42,561
  • 8
  • 45
  • 63
oaker
  • 27
  • 1
  • 8
  • 4
    I don't know postgresql, but you shouldn't be putting an alias in single quotes (or any kind of quote, ideally) – HoneyBadger May 03 '21 at 13:39
  • `as 'attribute id'` is invalid standard SQL to begin with. Postgres honors the SQL standard, that's why it rejects this. The relevant section of the manual is here: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS –  May 03 '21 at 14:23
  • 2
    I would suggest using underscores instead of spaces. Will save you a lot of troubles down the road. And you won't need to use quotes or backticks – Radagast May 03 '21 at 14:28

1 Answers1

3

You should use double quotes instead of single quote

Philippe
  • 1,714
  • 4
  • 17