postgres.query executes one statement inside a PostgreSQL READ ONLY transaction. PostgreSQL blocks its documented set of data-changing and DDL commands, but READ ONLY is not a pure-read sandbox. NOTIFY and routines can still create external effects.
Example
automations/query-postgres.automation.ts
Inputs
Output
Returns a signal with:
Each field contains
name, columnId, tableId, dataTypeId, dataTypeSize, dataTypeModifier, and format. Database column names and nested JSON keys remain unchanged because they belong to your schema; the PostgreSQL metadata property names use camel case.
Permissions and failures
Grant the connected roleCONNECT on the database, USAGE on referenced schemas, and only the SELECT or routine privileges the query needs. PostgreSQL returns SQLSTATE-backed errors for syntax, permissions, missing objects, timeouts, and data failures. Commands that PostgreSQL classifies as disallowed in a read-only transaction fail with SQLSTATE 25006 (read_only_sql_transaction); notifications and routines with external effects do not.
Automate.ax rejects multiple statements before connecting. It does not automatically retry this action because a read-only statement can still invoke a routine with an external side effect or send a PostgreSQL notification. Use Execute statement for one read/write statement or Run transaction for several atomic statements.
Connection security
Use apostgres:// or postgresql:// connection string for a dedicated least-privilege role. Prefer sslmode=verify-full with a trusted server certificate. With the current PostgreSQL client, sslmode=require verifies the server certificate unless you also set uselibpqcompat=true; that compatibility option encrypts without verifying server identity.