Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 596
Ma Rk Vilches Avatar asked Dec 08 '22 12:12

Ma Rk Vilches


1 Answers

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

like image 157
mu is too short Avatar answered Dec 11 '22 11:12

mu is too short