Postgresql tables exists, but getting “relation does not exist” when querying

后端 未结 8 2287
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 23:22

I have a postgresql db with a number of tables. If I query:

SELECT column_name
FROM information_schema.columns
WHERE table_name=\"my_table\";
8条回答
  •  再見小時候
    2020-11-30 23:55

    I had the same problem that occurred after I restored data from a postgres dumped db.

    My dump file had the command below from where things started going south.

        SELECT pg_catalog.set_config('search_path', '', false);
    

    Solutions:

    1. Probably remove it or change that false to be true.
    2. Create a private schema that will be used to access all the tables.

    The command above simply deactivates all the publicly accessible schemas.

    Check more on the documentation here: https://www.postgresql.org/docs/9.3/ecpg-connect.html

提交回复
热议问题