I keep getting the error "relation [TABLE] does not exist"
Asked Answered
I

1

6

I have been trying to query two tables in my database. In the server explorer I can see both tables and even see the columns within them. We'll call them Schema.table1 and Schema.table2 where "Schema" has its first letter capitalized. I have tried running the following queries:

select * from Schema.table1;

Where I get the following error:

ERROR: relation "schema.table1" does not exist

I then tried running the next query thinking maybe the capitalization in the schema made a difference.

Select * from "Schema.table1"; 
select "ID" from "Schema.table1";

But the same error persisted:

ERROR: relation "Schema.table1" does not exist

I later tried to specify the schema path with "SET search_path to "Schema1" and ran a query on the tables which again provided me the same error. Any ideas or help would be greatly appreciated.

Inextirpable answered 30/12, 2017 at 22:45 Comment(4)
The table does exist. I can see it in the server explorer and even view all of the columns. It's there.Inextirpable
Each element of an identifier needs to be quoted: "Schema"."table1"Gory
Is it Schema1 or Schema?Rotberg
@a_horse_with_no_name has solved the issue. thank you.Inextirpable
G
7

Each element has to be quoted individually:

select "ID" 
from "Schema"."table1";

More details about quoted identifiers are in the manual

Gory answered 21/2, 2018 at 6:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.