Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgres constantly gives "schema does not exist" errors [duplicate]

Tags:

sql

postgresql

I managed to create a table in a schema FOO.

Whenever I then try and do anything, like even a basic select, I just get:

ERROR: schema "FOO" does not exist
SQL state: 3F000
Character: 15

I am running the select in the same edit window as I created (using pgAdmin4). I get the same error when I try and create a view call FOO.Info. Yet when I try and create a new table in FOO it works.

What's going on? I am using the same syntax to refer to the table in the select as the create.

# worked fine
CREATE TABLE "FOO"."Events"
(
...

# all these have the error
select * from "FOO"."Events";
select * from FOO.Events;
select * from Foo.Events;
postgres=# \dn
  List of schemas
  Name  |  Owner   
--------+----------
 foo    | postgres
 public | postgres
(2 rows)
like image 693
aaa90210 Avatar asked May 19 '17 07:05

aaa90210


1 Answers

I believe you created it as

create schema FOO;

which creates schema "foo", not "FOO"

And then you reference it as

select * from "FOO".table_name

so it is not found

like image 160
Vao Tsun Avatar answered Sep 19 '22 00:09

Vao Tsun