File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 2424DECLARE
2525 v_count int8;
2626BEGIN
27+ -- corrupt _timescaledb_catalog.chunk_column_stats entries
2728 SELECT count (* ) INTO v_count FROM _timescaledb_catalog .chunk_column_stats WHERE range_start > range_end;
2829 IF v_count >= 1 THEN
2930 RAISE WARNING ' Found %s entries in _timescaledb_catalog.chunk_column_stats with range_start > range_end' , v_count;
3031 END IF;
32+ -- orphaned chunks
33+ SELECT count (* ), array_agg(oid ::regclass) INTO v_count, v_rels
34+ FROM pg_class
35+ WHERE
36+ relnamespace= ' _timescaledb_internal' ::regnamespace AND
37+ relkind= ' r' AND
38+ relname LIKE ' %_chunk' AND
39+ NOT EXISTS(SELECT FROM _timescaledb_catalog .chunk where schema_name= ' _timescaledb_internal' and table_name = relname);
40+ IF v_count >= 1 THEN
41+ RAISE WARNING ' Found % orphaned chunk relations: %' , v_count, v_rels;
42+ END IF;
3143END
3244$$ SET search_path = pg_catalog, pg_temp;
3345
You can’t perform that action at this time.
0 commit comments