snapshot_table
Copy a table into a timestamped backup before destructive changes, enabling manual rollback and returning the snapshot name and row count.
Instructions
Runs CREATE TABLE tmp_[_]_backup_YYYYMMDD AS SELECT * FROM [WHERE ...]. Use it BEFORE a destructive operation so a manual rollback is possible afterwards. The name must fit in 63 bytes. Returns the snapshot table name and the number of rows copied.
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": {
"source": "<source>"
},
"name": "snapshot_table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| where | No | Optional condition, without the WHERE keyword (e.g. status = 'OPEN'). One condition only: no ";", no data-modifying statements and no setval. Without it the whole table is copied (dangerous on large tables) | |
| source | Yes | Source table (e.g. tab_invoice) | |
| suffix | No | Optional suffix for the name (e.g. "phase_a") -> tmp_source_phase_a_backup_YYYYMMDD |