Skip to content

An organization administrator must enable and configure Access for a project before team members can start sessions.

Sign in to PgStack, create or select a project, and open its Access settings. Configure the upstream PostgreSQL connection and verify connectivity.

SSH tunneling is supported out of the box. Contact us to connect to your upstream PostgreSQL from static IPs, or to configure VPN, AWS Systems Manager (SSM), or other connection setups.

The optional --read-only flag guards against accidental writes during an Access session:

Terminal window
pgstack access start --env production --read-only --reason "Investigate delayed orders"

The guard applies to every connection using that session URL. The proxy starts upstream transactions in read-only mode and sets 60-second statement and idle-in-transaction timeouts.

SQL Proxy behavior
SELECT, including joins and read-only CTEs, VALUES, TABLE, SHOW Allowed
Plain EXPLAIN of an allowed read, basic transaction and savepoint commands Allowed
INSERT, UPDATE, DELETE, MERGE, CREATE, ALTER, DROP, TRUNCATE Blocked, including writes inside CTEs
SELECT INTO, SELECT ... FOR UPDATE or FOR SHARE, EXPLAIN ANALYZE Blocked
SET, RESET, SET ROLE, BEGIN READ WRITE, COPY, CALL, DO, SQL PREPARE and EXECUTE Blocked; parameterized queries through the PostgreSQL wire protocol are supported
Multiple statements in one simple query Allowed only if every statement passes
Function calls inside allowed queries Allowed unless blocked by name, such as set_config, nextval, or dblink_exec

Some clients run session initialization statements such as SET commands. These are blocked in a read-only session. Adjust client initialization settings if they prevent the connection from being used.

Database permissions are enforced by the upstream PostgreSQL user configured for the connection. A separate user can be granted read access to the tables in a schema.

Run the following while connected to your upstream PostgreSQL as an administrator. Replace [database] with your database name, [owner] with the user that creates tables, and [replace-with-a-strong-password] with a strong password.

CREATE USER pgstack_readonly WITH PASSWORD '[replace-with-a-strong-password]';
GRANT CONNECT ON DATABASE [database] TO pgstack_readonly;
GRANT USAGE ON SCHEMA public TO pgstack_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO pgstack_readonly;
ALTER DEFAULT PRIVILEGES FOR ROLE [owner] IN SCHEMA public
GRANT SELECT ON TABLES TO pgstack_readonly;

Configure the upstream connection with this user's credentials. The grants cover existing tables in public and future tables created by [owner]. Repeat the schema grants and default privileges for other schemas or table-creating users as needed.

Team admins and engineers can create, extend, and revoke their own sessions. Regular members can sign in and list their own active sessions. Organization administrators manage Access configuration.

When configuration is complete, follow the quickstart to verify a session with your SQL client.

If credentials stop working, check that the session is still active and has not expired or been revoked. Confirm that you copied the entire URL and that your client can reach its host.