pgAdmin error - relation "[name of function/Views/Trigger Functions]" does not exist

StackOverflow https://stackoverflow.com/questions/19128870

  •  30-06-2022
  •  | 
  •  

문제

I'm just new to pgAdmin, so I don't really know what causes these errors:

ERROR:  relation "ongoingprojects" does not exist
LINE 1: SELECT * FROM ongoingProjects;
                      ^

********** Error **********

ERROR: relation "ongoingprojects" does not exist
SQL state: 42P01
Character: 15

Even if the function/view exists in the schema. Why does it give that error? And what should I do to fix it?

도움이 되었습니까?

해결책

Pay careful attention to the error message:

ERROR: relation "ongoingprojects" does not exist

Note that it is complaining about ongoingprojects when your SQL talks about ongoingProjects. You probably created the table with something like:

create table "ongoingProjects" ( ...

PostgreSQL folds all identifiers (table names, column names, ...) to lower case unless they are double quoted. Once you've created the table as "ongoingProjects", you'll have to double quote the name everywhere and exactly match that case:

select * from "ongoingProjects";

The usual practice with PostgreSQL is to create tables with unquoted names in lower case with word separated using underscores:

create table ongoing_projects ( ...

so that you don't have worry about quoting.

Here is the link to the relevant part of the manual

다른 팁

For me the issue was having a schema named differently than the database.

Two solutions:

1) Modify schema name to match db name

or

2) Prepend table in query with schema name, eg: SELECT * FROM my_schema.ongoingProjects;

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top