brianc/node-postgres-docs

permission denied for table

bcneves13 opened this issue · 1 comments

I'm developing a Multitenancy application and i need a new connection or pool for any user to connect on he's company database and I'm getting a error: permission denied for table

Using these connection string
let connectionString = 'postgresql://$_tenantDB_$_user:$_secretDB_$@localhost:5432/$_tenantDB_$';
I replace the selected chars and i get a successfull connection
Client { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, connectionParameters: ConnectionParameters { user: 'tenant001_user', database: 'tenant001', port: 5432, host: 'localhost', binary: false, options: undefined, ssl: false, client_encoding: '', replication: undefined, isDomainSocket: false, application_name: undefined, fallback_application_name: undefined, statement_timeout: false, idle_in_transaction_session_timeout: false, query_timeout: false, connect_timeout: 0 }, user: 'tenant001_user', database: 'tenant001', port: 5432, host: 'localhost', replication: undefined, _Promise: [Function: Promise], _types: TypeOverrides { _types: { getTypeParser: [Function: getTypeParser], setTypeParser: [Function: setTypeParser], arrayParser: [Object], builtins: [Object] }, text: {}, binary: {} }, _ending: false, _connecting: false, _connected: true, _connectionError: false, _queryable: true, ...
So, the _queryable its true, but I cannot make any query works on it.

This looks like a problem with how your roles’ permissions are set up, not a driver problem. You should be able to reproduce the error with psql -U tenant001_user, for example.

https://www.postgresql.org/docs/current/ddl-priv.html