upsert_rows
Insert or update rows in a PostgreSQL table using a defined conflict key, with typed row data and optional validation of affected row count.
Instructions
Upsert typed rows through a verified primary or unique conflict key
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"schema_name": "<schema_name>",
"relation_name": "<relation_name>",
"rows": "<rows>",
"conflict_columns": "<conflict_columns>"
},
"name": "upsert_rows"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | Rows sharing one column set | |
| returning | No | Columns returned after commit validation | |
| schema_name | Yes | Exact schema name | |
| expected_rows | No | Optional exact affected row count | |
| relation_name | Yes | Exact table name | |
| update_columns | No | Inserted columns updated on conflict | |
| conflict_columns | Yes | Complete primary or non-partial unique key | |
| max_affected_rows | No | Hard mutation ceiling |