Skip to main content
postgres.execute executes exactly one statement in its own implicit PostgreSQL transaction. Use it for INSERT, UPDATE, DELETE, DDL, and other work that can change database state.

Example

automations/update-customer.automation.ts

Inputs

Use parameters for values. PostgreSQL does not accept parameters for schema, table, or column identifiers.

Output

Returns command, rowCount, rows, and fields in the same shape as Run query. Add RETURNING to a mutation when you need changed rows.

Permissions and retries

Grant the connected role only the privileges required by the statement. Common mutations need schema USAGE, the matching table privilege, and sequence USAGE for generated identifiers. DDL usually requires object ownership or schema CREATE. This action is not replay-safe. If PostgreSQL accepts a mutation but the connection fails before Automate.ax receives the result, Automate.ax does not repeat the statement automatically. Use database constraints or an idempotency key in your schema when callers can retry the automation. For several changes that must commit together, use Run transaction.