Skip to main content
postgres.transaction executes 1–100 statements on one connection between BEGIN and COMMIT. PostgreSQL rolls the complete transaction back after the first failure.

Example

automations/create-order.automation.ts

Inputs

Each statement contains one non-empty sql string and optional (JsonValue | bigint | Date | Uint8Array)[] parameters. Transaction-control statements such as BEGIN, COMMIT, ROLLBACK, and SAVEPOINT are rejected because the action owns the transaction boundary.

Output

Returns { results }. results contains one command, rowCount, rows, and fields envelope per statement in input order.

Permissions, failures, and retries

The connected role needs the union of the exact database privileges required by every statement. The first PostgreSQL failure stops execution and rolls back earlier changes. If rollback itself fails, the action reports both failures. This action is not replay-safe. A connection loss during COMMIT can leave transaction resolution unknown, so Automate.ax does not repeat the transaction automatically. Use durable business keys and constraints when a caller may retry the automation.