I have ran the following SQL in psql:
CREATE USER bspu LOGIN;
CREATE DATABASE bsp OWNER bspu;
GRANT ALL PRIVILEGES ON DATABASE bsp TO bspu;
\c bsp
CREATE TABLE users (
id SERIAL PRIMARY KEY,
client_id VARCHAR(20) NOT NULL,
api_key VARCHAR(100) NOT NULL,
api_secret VARCHAR(100) NOT NULL,
auth_token VARCHAR(128) NOT NULL
);
When I login as bspu
, and try to query the users
table, I get the error:
permission denied for relation users
I tried running:
ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO bspu;
But it doesn't help. What am I doing wrong? Why does database owner NOT have permissions to query its own database?
EDIT:
I upgraded bspu
to superuser for now, so I can continue work. Any further guidance appreciated.
\dt "users"
show?SELECT session_user, current_user
at the top of your script? And what is your Postgres version?