]> Untitled Git - lemmy.git/blob - migrations/2022-09-07-113813_drop_ccnew_indexes_function/up.sql
Adding job to drop phantom ccnew indexes. Fixes #2431 (#2432)
[lemmy.git] / migrations / 2022-09-07-113813_drop_ccnew_indexes_function / up.sql
1 CREATE OR REPLACE FUNCTION drop_ccnew_indexes() RETURNS INTEGER AS $$
2 DECLARE
3 i RECORD;
4 BEGIN
5   FOR i IN
6     (SELECT relname FROM pg_class WHERE relname like '%ccnew%')
7     LOOP
8       EXECUTE 'DROP INDEX ' || i.relname;
9     END LOOP;
10     RETURN 1;
11   END;
12 $$ LANGUAGE plpgsql;
13