The SHOW INSPECT ERRORS statement displays errors recorded by an INSPECT job.
SHOW INSPECT ERRORS shows results for a single INSPECT job at a time; it does not aggregate results across jobs. By default, it returns errors from the most recent completed, successful INSPECT job for the specified table. To view errors from a specific job, use SHOW INSPECT ERRORS FOR JOB {job_id}.
Required privileges
To run SHOW INSPECT ERRORS, the user must have:
- The
INSPECTsystem-level privilege, which is required to run theINSPECTstatement.
Synopsis
Parameters
| Parameter | Syntax | Description |
|---|---|---|
opt_for_table_clause |
FOR TABLE {table_name} |
Optional. Show errors for the specified table. |
opt_for_job_clause |
FOR JOB {job_id} |
Optional. Show errors produced by the job ID returned by the INSPECT statement. |
opt_with_details |
WITH DETAILS |
Optional. Include structured error metadata from the details column (JSON) in the results. |
Response
SHOW INSPECT ERRORS returns the following columns, with one row per issue detected.
| Field | Description |
|---|---|
job_id |
The ID of the INSPECT job that detected the issue. |
error_type |
The type of inconsistency detected. For more information, see Error types. |
aost |
The AS OF SYSTEM TIME timestamp used by the validation job (if any). |
database_name |
The database containing the schema object with an issue. |
schema_name |
The schema containing the object with an issue. |
object_name |
The table or index with an issue. |
primary_key |
The primary key of the row involved in the issue, if applicable. |
details |
This column is present only if WITH DETAILS is specified. It contains structured metadata (JSON) describing the issue. |
Error types
The INSPECT implementation reports the following error_type values:
| Error type | Meaning |
|---|---|
missing_secondary_index_entry |
A row in the primary index is missing a corresponding entry in a secondary index. If you see this error, contact Support. |
dangling_secondary_index_entry |
A secondary index entry exists, but the referenced primary index row does not. If you see this error, contact Support. |
internal_error |
An error occurred while INSPECT was running its validation queries (for example, an MVCC GC timeout). The cause of this error type is usually not related to data validity. Investigate the underlying job error details and cluster logs to determine the cause before deciding whether to contact Support. |
Examples
Show the latest errors for a table
To see the errors found by the most recent INSPECT job, issue the following statement:
SHOW INSPECT ERRORS FOR TABLE movr.public.users;
Show errors for a specific inspection job
When you issue the INSPECT statement, a NOTICE message is returned to the client showing the job ID, e.g.,
INSPECT TABLE movr.public.users AS OF SYSTEM TIME '-10s';
NOTICE: waiting for INSPECT job to complete: 1141477013029322753
If the statement is canceled, the job will continue in the background.
To show errors for a job, issue the following statement:
SHOW INSPECT ERRORS FOR JOB 1141477013029322753;
If there are no errors associated with that job ID, the output is:
SHOW INSPECT ERRORS 0
Note that if you issue a job ID for a nonexistent job, you will see the same output as for a job with no errors:
SHOW INSPECT ERRORS FOR JOB 0;
SHOW INSPECT ERRORS 0
Show errors with details
SHOW INSPECT ERRORS FOR TABLE movr.public.users WITH DETAILS;
See also
---
title: SHOW INSPECT ERRORS
summary: Display errors from data consistency validation jobs in CockroachDB.
toc: true
docs_area: reference.sql
---
The SHOW INSPECT ERRORS statement displays errors from data consistency validation jobs. This statement is currently unimplemented and will be fully functional in a future release.
Required privileges
The user must have the INSPECT system privilege.
Synopsis
SHOW INSPECT ERRORS [FOR TABLE table_name] [FOR JOB job_id] [WITH DETAILS]
Parameters
| Parameter | Description |
|---|---|
table_name |
Show errors only for the specified table |
job_id |
Show errors only for the specified data consistency validation job ID |
WITH DETAILS |
Include additional detailed information about each error |
Examples
Show all data consistency validation errors:
SHOW INSPECT ERRORS;
Show errors for a specific table:
SHOW INSPECT ERRORS FOR TABLE users;
Show errors for a specific validation job:
SHOW INSPECT ERRORS FOR JOB 123456789;
Show detailed error information:
SHOW INSPECT ERRORS WITH DETAILS;
Combine options to filter errors for a specific table and job with details:
SHOW INSPECT ERRORS FOR TABLE orders FOR JOB 987654321 WITH DETAILS;
This statement is currently unimplemented. The grammar has been added in preparation for future data consistency validation functionality.
See also
[NEEDS REVIEW: The exact output format and available columns are not specified since the statement is unimplemented. The system.inspect_errors table structure should be documented once the implementation is complete.]