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

前端 未结 2 1531
名媛妹妹
名媛妹妹 2021-01-06 10:35

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

ERROR:  relation \"ongoingprojects\" doe         


        
相关标签:
2条回答
  • 2021-01-06 10:57

    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;

    0 讨论(0)
  • 2021-01-06 10:59

    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

    0 讨论(0)
提交回复
热议问题