0

I have a Postgres db. The tables are each in separate namespaces, which are named using two character state codes. The problem is this: for the state Indiana, the state code is "in". I am trying to execute this query:

SELECT city_name
FROM in.places

But I keep getting an error complaining about the 'in', presumably because there is a reserved keyword IN. How can I query the tables inside the 'in' namespace?

Blighty
  • 199
  • 5
  • 20
  • `"IN"`, but I'd instead chose some other name. https://en.wikipedia.org/wiki/SQL_reserved_words – jarlh Jul 19 '21 at 12:43
  • 1
    If you are stuck with this awful naming convention (the data should all be in one table), then use either `"in".places` or `"in.place"` -- whichever is appropriate. – Gordon Linoff Jul 19 '21 at 12:45
  • Mandatory read [Identifiers and Key Words](https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS) in the Postgres manual –  Jul 19 '21 at 14:01

0 Answers0