Integrity check
pg_integrity_checkDetect PostgreSQL integrity issues: invalid indexes, missing primary keys, disabled triggers, orphaned sequences, checksum failures; optionally verify b-tree indexes and report fixes without writes.
Instructions
Look for data integrity problems: invalid indexes, constraints added NOT VALID, tables without a primary key, forgotten prepared transactions, disabled triggers (including foreign key enforcement), collation versions that changed under the server, data checksums off or failing, and sequences that no column owns.
schema limits the object checks to one schema. With index (the name of a b-tree
index) and the amcheck extension (PostgreSQL 10+) it also verifies that index's
structure with bt_index_check, which needs a superuser and reads the whole index. Nothing
is changed; each problem comes with a fix to apply yourself.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "pg_integrity_check"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | No | ||
| schema | No | ||
| connection | No |