|
| 1 | +onlyif config local-mixed-25.2 local-mixed-25.3 |
| 2 | +statement error pq: SHOW INSPECT ERRORS requires the cluster to be upgraded to v25.4 |
| 3 | +SHOW INSPECT ERRORS |
| 4 | + |
1 | 5 | user testuser
|
2 | 6 |
|
3 |
| -skipif config local-mixed-25.2 |
4 |
| -skipif config local-mixed-25.3 |
| 7 | +skipif config local-mixed-25.2 local-mixed-25.3 |
5 | 8 | statement error pq: user testuser does not have INSPECT system privilege
|
6 | 9 | SHOW INSPECT ERRORS
|
7 | 10 |
|
8 | 11 | user root
|
9 | 12 |
|
10 |
| -skipif config local-mixed-25.2 |
11 |
| -skipif config local-mixed-25.3 |
| 13 | +statement ok |
| 14 | +GRANT SYSTEM INSPECT TO testuser; |
| 15 | + |
| 16 | +skipif config local-mixed-25.2 local-mixed-25.3 |
12 | 17 | statement error relation "bad_table" does not exist
|
13 | 18 | SHOW INSPECT ERRORS FOR TABLE bad_table
|
14 | 19 |
|
15 | 20 | statement ok
|
16 |
| -CREATE TABLE foo (a INT) |
| 21 | +CREATE TABLE foo (a INT); |
| 22 | +CREATE TABLE bar (b INT); |
| 23 | + |
| 24 | +let $foo_table_id |
| 25 | +SELECT 'foo'::regclass::oid |
| 26 | + |
| 27 | +let $bar_table_id |
| 28 | +SELECT 'bar'::regclass::oid |
| 29 | + |
| 30 | +let $database_id |
| 31 | +SELECT id FROM system.namespace WHERE name = current_database() AND "parentID" = 0 |
| 32 | + |
| 33 | +let $schema_id |
| 34 | +SELECT current_schema()::regnamespace::oid |
| 35 | + |
| 36 | +let $aost |
| 37 | +SELECT '2025-09-23-11:02:14-04:00'::timestamp |
| 38 | + |
| 39 | +# the job_info insert addresses the `crdb_internal.system_jobs` inner join |
| 40 | +statement ok |
| 41 | +INSERT INTO system.jobs (id, owner, status, job_type) |
| 42 | +VALUES (555, 'testuser', 'failed', 'INSPECT'); |
| 43 | +INSERT INTO system.job_info (job_id, info_key) |
| 44 | +VALUES (555, 'legacy_payload'); |
17 | 45 |
|
18 |
| -skipif config local-mixed-25.2 |
19 |
| -skipif config local-mixed-25.3 |
| 46 | +skipif config local-mixed-25.2 local-mixed-25.3 |
20 | 47 | statement ok
|
21 |
| -SHOW INSPECT ERRORS |
| 48 | +INSERT INTO system.inspect_errors (job_id, error_type, aost, database_id, schema_id, id, details) |
| 49 | +VALUES |
| 50 | + (555, '555_foo', '$aost', $database_id, $schema_id, $foo_table_id, '{"detail":"555\"foo"}'), |
| 51 | + (555, '555_bar', '$aost', $database_id, $schema_id, $bar_table_id, '{"detail":"555\"bar"}'); |
22 | 52 |
|
23 |
| -skipif config local-mixed-25.2 |
24 |
| -skipif config local-mixed-25.3 |
25 | 53 | statement ok
|
26 |
| -SHOW INSPECT ERRORS WITH DETAILS |
| 54 | +INSERT INTO system.jobs (id, owner, status, job_type) |
| 55 | +VALUES (666, 'testuser', 'failed', 'INSPECT'); |
| 56 | +INSERT INTO system.job_info (job_id, info_key) |
| 57 | +VALUES (666, 'legacy_payload'); |
27 | 58 |
|
28 |
| -skipif config local-mixed-25.2 |
29 |
| -skipif config local-mixed-25.3 |
| 59 | +skipif config local-mixed-25.2 local-mixed-25.3 |
30 | 60 | statement ok
|
31 |
| -SHOW INSPECT ERRORS FOR JOB 666 |
| 61 | +INSERT INTO system.inspect_errors (job_id, error_type, aost, database_id, schema_id, id, details) |
| 62 | +VALUES (666, '666_foo', '$aost', $database_id, $schema_id, $foo_table_id, '{"detail1":"\u2603 666_foo_1","detail2":"\n666_foo_2"}'); |
32 | 63 |
|
33 |
| -skipif config local-mixed-25.2 |
34 |
| -skipif config local-mixed-25.3 |
35 | 64 | statement ok
|
36 |
| -SHOW INSPECT ERRORS FOR TABLE foo |
| 65 | +INSERT INTO system.jobs (id, owner, status, job_type) |
| 66 | +VALUES (777, 'testuser', 'running', 'INSPECT'); |
| 67 | +INSERT INTO system.job_info (job_id, info_key) |
| 68 | +VALUES (777, 'legacy_payload'); |
37 | 69 |
|
38 |
| -skipif config local-mixed-25.2 |
39 |
| -skipif config local-mixed-25.3 |
| 70 | +skipif config local-mixed-25.2 local-mixed-25.3 |
40 | 71 | statement ok
|
41 |
| -SHOW INSPECT ERRORS FOR TABLE foo FOR JOB 666 WITH DETAILS |
| 72 | +INSERT INTO system.inspect_errors (job_id, error_type, aost, database_id, schema_id, id, details) |
| 73 | +VALUES (777, '777_foo', '$aost', $database_id, $schema_id, $foo_table_id, '{"detail":"777 foo"}'); |
| 74 | + |
| 75 | +user testuser |
| 76 | + |
| 77 | +# no options should show most records from the recent completed job |
| 78 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 79 | +query TTTTTIT colnames |
| 80 | +SHOW INSPECT ERRORS |
| 81 | +---- |
| 82 | +error_type database_name schema_name table_name primary_key job_id aost |
| 83 | +666_foo test public foo NULL 666 2025-09-23 04:00:00.000000 |
| 84 | + |
| 85 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 86 | +query TTTTTITT colnames |
| 87 | +SHOW INSPECT ERRORS WITH DETAILS |
| 88 | +---- |
| 89 | +error_type database_name schema_name table_name primary_key job_id aost details |
| 90 | +666_foo test public foo NULL 666 2025-09-23 04:00:00.000000 { |
| 91 | + "detail1": "☃ 666_foo_1", |
| 92 | + "detail2": "\n666_foo_2" |
| 93 | + } |
| 94 | + |
| 95 | +# specifying a job shows results regardless of status |
| 96 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 97 | +query TTTTTIT |
| 98 | +SHOW INSPECT ERRORS FOR JOB 777 |
| 99 | +---- |
| 100 | +777_foo test public foo NULL 777 2025-09-23 04:00:00.000000 |
| 101 | + |
| 102 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 103 | +query TTTTTIT nosort |
| 104 | +SHOW INSPECT ERRORS FOR JOB 555 |
| 105 | +---- |
| 106 | +555_bar test public bar NULL 555 2025-09-23 04:00:00.000000 |
| 107 | +555_foo test public foo NULL 555 2025-09-23 04:00:00.000000 |
| 108 | + |
| 109 | +# query by table shows records from the most recent completed job that reported errors on that table |
| 110 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 111 | +query TTTTTIT |
| 112 | +SHOW INSPECT ERRORS FOR TABLE foo |
| 113 | +---- |
| 114 | +666_foo test public foo NULL 666 2025-09-23 04:00:00.000000 |
| 115 | + |
| 116 | +# and query by table only shows records for that given table |
| 117 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 118 | +query TTTTTIT |
| 119 | +SHOW INSPECT ERRORS FOR TABLE bar |
| 120 | +---- |
| 121 | +555_bar test public bar NULL 555 2025-09-23 04:00:00.000000 |
| 122 | + |
| 123 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 124 | +query TTTTTIT |
| 125 | +SHOW INSPECT ERRORS FOR TABLE public.bar |
| 126 | +---- |
| 127 | +555_bar test public bar NULL 555 2025-09-23 04:00:00.000000 |
| 128 | + |
| 129 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 130 | +query TTTTTIT |
| 131 | +SHOW INSPECT ERRORS FOR TABLE test.public.bar |
| 132 | +---- |
| 133 | +555_bar test public bar NULL 555 2025-09-23 04:00:00.000000 |
| 134 | + |
| 135 | +skipif config local-mixed-25.2 local-mixed-25.3 |
| 136 | +query TTTTTITT colnames |
| 137 | +SHOW INSPECT ERRORS FOR TABLE foo FOR JOB 555 WITH DETAILS |
| 138 | +---- |
| 139 | +error_type database_name schema_name table_name primary_key job_id aost details |
| 140 | +555_foo test public foo NULL 555 2025-09-23 04:00:00.000000 { |
| 141 | + "detail": "555\"foo" |
| 142 | + } |
0 commit comments