Skip to main content
3 of 3
naming; English usage; removed thanks
Vince
  • 20.3k
  • 16
  • 48
  • 65

Create PostgreSQL user for QGIS project

I have some data in a PostgreSQL database, I use pgAdmin4 for the organisation of the data. I want to create a QGIS project for other users with the data from my database. The users of the project should see the data, load own data to the project, but they should not be able to change my database files.

Therefore I create a user qgis in pgAdmin with this SQL statemant

CREATE ROLE "qgis" with
LOGIN
NOSUPERUSER
NOCREATEDB
NOCREATEROLE
NOINHERIT
NOREPLICATION
CONNECTION LIMIT -1
PASSWORD 'xxxx';

Aftre the creation of the user I give him the privilege SELECT for the different tables in my schema with the statement

GRANT SELECT ON TABLE example_1 TO qgis;

But with this privilege the user can't load the data in QGIS. So I give the user the privilege USAGE. Then the user can load the data in QGIS, but he can also delete data in the database and add new file. How can I create a user, that can connect to my database, read the data, but nothing more?

joe_gerner
  • 427
  • 1
  • 9
  • 28