0

I am connecting to a Postgres/PostGIS database using QGIS. Within my database are a few schemas. However, in QGIS I only see the public schema, but not the others schema that are within the database. How would I display all schemas?

4
  • Normally you should see all schemas. Even if you don't have the permission to do anything on the schema you should be able to see the schema (same for pgAdmin). Nov 2, 2022 at 13:04
  • @BerndLoigge I see them in the Browser Panel, but when I go to 'Layer - Add Layer - PostGIS' I do not see all the schemas, only public.
    – four-eyes
    Nov 2, 2022 at 13:08
  • 2
    Ok, then it is a security issue that the user you use to connect to the database doesn't have the rights to see the schemas. Nov 2, 2022 at 13:09
  • @BerndLoigge Really? Why can I see it in the browser panel, but not when I go through the menue? How would I give the permissions?
    – four-eyes
    Nov 2, 2022 at 19:52

1 Answer 1

0

QGIS is filtering out all schemas where you don't have permission on any possible data / layer (wouldn't make sense to show it). But that's handled by QGIS. Even though you don't have permission you can always see a schema / table in postgres (see). To give your user the appropriate permissions you need to have another user that has more privileges. With this user you can then alter your user and grant at least SELECT rights:

GRANT SELECT ON ALL TABLES IN SCHEMA someschema TO someuser;

Update - how to create a Database Connection

  1. In the sidebar click the Postgres Icon
  2. Choose Postgres Connection
  3. Click New
  4. Fill in your DB connection details
  5. Click the + Icon for adding a new authentication
  6. Add your credentials (PG User)

enter image description here

After adding a new connection you can directly add a layer via the tree, in this dialog by clicking Connect or you can use the DB Manager where you can also write SQL statements.

6
  • Thanks. but how do I connect with this user to the database from QGIS?
    – four-eyes
    Nov 3, 2022 at 8:22
  • I would recommend granting the privileges using a tool like pgAdmin or psql via the command line. if you have another user with more privileges you can create another connection using those credentials in QGIS Nov 3, 2022 at 10:19
  • Thanks for the reply. I know where to execute these lines. But in QGIS, I do not connect with a user. I simply start the QGIS App... Which user would I add with GRANT SELECT ...
    – four-eyes
    Nov 3, 2022 at 19:30
  • you are writing you are connecting to postgres using QGIS in your question. I cant help you. your questions dont make sense. Nov 4, 2022 at 14:32
  • Hm... In the QGIS Gui there is a Dialog which opens upon Add Layer - Add PostGIS Layer. When I add a new connection there, I only add information like Name, Service, Host, Port, Database. Thats it. Where to choose a user there?
    – four-eyes
    Nov 4, 2022 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.