Skip to content

Commit 30f1e90

Browse files
committed
Simplify logic for printing orphaned entries
1 parent 35d55b6 commit 30f1e90

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

diagnostic.sql

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ BEGIN
5757
NOT dropped AND
5858
NOT EXISTS (SELECT FROM pg_class c JOIN pg_namespace n ON c.relnamespace = n.oid WHERE c.relname=ch.table_name AND n.nspname = ch.schema_name);
5959
IF v_count > 0 THEN
60-
IF v_count < 20 THEN
61-
RAISE WARNING 'Found % chunk entries without relations: %', v_count, v_relnames;
62-
ELSE
63-
RAISE WARNING 'Found % chunk entries without relations', v_count;
64-
END IF;
60+
RAISE WARNING 'Found % chunk entries without relations: %', v_count, v_relnames[1,20];
6561
END IF;
6662

6763
-- orphaned chunks
@@ -73,11 +69,7 @@ BEGIN
7369
relname LIKE '%_chunk' AND
7470
NOT EXISTS(SELECT FROM _timescaledb_catalog.chunk where schema_name='_timescaledb_internal' and table_name = relname);
7571
IF v_count > 0 THEN
76-
IF v_count < 20 THEN
77-
RAISE WARNING 'Found % orphaned chunk relations: %', v_count, v_rels;
78-
ELSE
79-
RAISE WARNING 'Found % orphaned chunk relations', v_count;
80-
END IF;
72+
RAISE WARNING 'Found % orphaned chunk relations: %', v_count, v_rels[1,20];
8173
END IF;
8274
END
8375
$$ SET search_path = pg_catalog, pg_temp;

0 commit comments

Comments
 (0)