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?

3
  • "IN", but I'd instead chose some other name. en.wikipedia.org/wiki/SQL_reserved_words Commented Jul 19, 2021 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. Commented Jul 19, 2021 at 12:45
  • Mandatory read Identifiers and Key Words in the Postgres manual Commented Jul 19, 2021 at 14:01

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.