GRANT SELECT Simply not working
In PostgreSQL, every connection is to a particular database, and nearly everything you run has effect only within that one database. (One exception is that creation of users/roles themselves is global to the entire "cluster", i.e. running Postgres server.)
In the psql
commands you show, you are connecting the first time without specifying a database (psql
), which connects you to a database named after the current system user, which is postgres
. This is shown at the beginning of the psql
prompt: postgres=#
(the #
shows that you are connected as a supersuser).
It is therefore only this database that is being changed by your GRANT
statements.
Your second example uses the correct command to connect to a specific database, psql proton
, and you can see that the prompt reflects this: proton=>
(with the >
replacing the #
, since you are not connected as a superuser).
So all you need to do is run psql proton
as your postgres
user, and run your GRANT
statements as superuser on that specific database. Your prompt will read proton=#
to show you are in the right place.