Update Rows
db_update_manyUpdates all rows matching a filter in PostgreSQL, with schema validation before execution and safety controls like dry-run and required confirmation for full-table updates.
Instructions
Updates all rows matching the given filter. Every column and value is validated against the live schema before execution. When the filter is empty ('{}'), ALL rows in the table would be updated — this requires confirmAll=true as a safety gate. A warning is issued when more than 10 rows are affected. Use dry_run=true to preview the update without actually writing.
When to use:
"Mark all pending orders as shipped"
"Update user 42's email to new@example.com"
"Set all products in category X as discontinued"
Parameter guidance:
table: the target table name (required)
where: JSON filter selecting rows to update (required). Example: {"status": "pending"} Use '{}' with confirmAll=true to update ALL rows (dangerous!).
data: JSON object of column-value pairs to set (required). Example: {"status": "shipped", "shipped_at": "2026-09-01"}
dry_run: set to true to preview without writing (default: false)
confirmAll: REQUIRED when where='{}' to confirm updating all rows
Behavioral notes:
A warning is emitted when more than 10 rows would be affected.
Empty filter with confirmAll=false returns an error requiring explicit confirmation.
The update runs in a transaction — all rows are updated atomically.
Returns the count of affected rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | JSON object of column-value pairs to set | |
| table | Yes | Name of the table to query | |
| where | Yes | JSON filter selecting rows to update | |
| dryRun | No | If true, simulates without writing | |
| database | No | Name of the database to query (from pgautopilot.json). Omit to use the current default database. | |
| confirmAll | No | Required to update all rows when where is '{}' |