Problem when granting permissions in DB-PostgreSQL

1

good day.

I am having problems granting all permissions to a user on a database that I am creating. Use PostgreSQL 9.6.

  • First I create my user in this way: CREATE USER springappuser WITH PASSWORD 'pspringappuser';

  • The database is created as follows: CREATE DATABASE springapp;

  • To make the permission assignment I use the following: GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA springapp TO springappuser;

  • I understand that the part of IN SCHEMA is wrong, but looking in the documentation I could not find how to do it on the basis of data.

        
    asked by Gibrán 25.03.2017 в 01:42
    source

    1 answer

    1

    springapp is not a schema, it is a database.

    What you want to do is give privileges on all the tables of a schema within that database, which I suppose would be the schema public .

    GRANT USAGE ON SCHEMA public TO springappuser;
    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO springappuser;
    

    This is done having already entered the database that you created. If you are using psql, it would be done with

    \d springapp
    
        
    answered by 25.03.2017 / 01:59
    source