a month ago
Hello Railway team,
I would like clarification of Railway's built-in PostgreSQL Database SQL Editor and its supported least-privilege metadata inspection workflow. This is a general platform question; no account-specific investigation is requested.
The Database UI exposes an SQL editor and a New Table action. No assumptions about a specific account or database principal are being made. We are requesting platform documentation and guidance, not application debugging.
A. Which PostgreSQL principal does the built-in editor use? Is it the database/application owner, an administrative principal, or a separate restricted role? How can the owner verify the actual target mapping and effective privileges without exposing connection secrets?
B. What are the editor's transaction semantics: autocommit, explicit BEGIN/COMMIT/ROLLBACK, same-connection multi-statement execution, READ ONLY transactions and statement/lock timeouts? Does it split batches, retry statements, or perform initialization/background actions?
C. Is there a documented way to enforce metadata-only read-only inspection through this editor at the privilege/channel level, rather than relying only on a READ ONLY transaction or a UI label? Can it use a separately authenticated restricted principal? Does it support psql meta-commands or only server SQL?
D. If the editor cannot provide those restrictions, what official least-privilege mechanism do you recommend for reading PostgreSQL catalogs, information_schema and the Alembic revision metadata table, without reading user records?
E. Would that mechanism require a new role, network/public endpoint changes, a restart, service/configuration changes, another tool, or additional costs? Can an existing restricted role be used over an existing private connection without disclosing credentials or adding a public database endpoint?
F. Can this inspection be performed without reading application user rows and without restarting or changing the running application? Please identify any unavoidable locks or operational effects rather than guaranteeing zero impact.
G. Please link the documentation and state which guarantees are enforced by Railway versus PostgreSQL role permissions. If no supported route meets these constraints, please say so.
Please provide clarification only. Do not execute commands or queries, create roles, change grants, migrate, restart/deploy, expose endpoints or change plans/configuration on our behalf. No credentials, connection strings, tokens, SQL templates/dumps, source code, logs or user records are attached.
Thank you.
1 Reply
a month ago
The Database tab's SQL editor connects as the role in the database service's PGUSER / PGPASSWORD variables (falling back to POSTGRES_USER / POSTGRES_PASSWORD), against the database named by PGDATABASE / POSTGRES_DB. On a standard Railway Postgres that's the superuser the template provisions. You can't pick a different or separately authenticated role in the editor, so changing those variables is the only way to change which role it uses.
Each query runs autocommitted on a single session, with a 30-second statement timeout applied before each query. One statement runs per execution, so batches aren't split into multiple statements. Queries aren't retried. Only server SQL is accepted, not psql meta-commands. The dashboard's read-only behavior only limits which UI actions appear. It doesn't stop SQL writes at the privilege level.
That means any privilege-enforced, metadata-only inspection comes from PostgreSQL role permissions, not from us. The supported route is a restricted role you create yourself, used from a client over the private network, for example from a service already in the project. Doing this doesn't require a public endpoint or a restart. Creating a role and its grants is a DDL change on your database, and catalog reads take only light locks, but we can't promise zero impact.
Everything beyond network access and the editor's own behavior, including what a role can read, is enforced by PostgreSQL. See Private Networking and PostgreSQL.
Status changed to Awaiting User Response Railway • about 1 month ago
24 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 24 days ago