1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2024-11-24 08:42:27 +02:00
explain.depesz.com/sql/patch-014.sql
2021-11-23 13:16:20 +01:00

4 lines
364 B
SQL

SELECT format('ALTER TABLE plans.%I SET SCHEMA public;', relname) FROM pg_class WHERE relkind = 'r' AND relnamespace = 'plans'::regnamespace \gexec
SELECT format('ALTER TABLE public.%I rename to %I;', relname, 'plans_' || relname) FROM pg_class WHERE relkind = 'r' AND relnamespace = 'public'::regnamespace AND relname ~ '^part_[0-9]+$' \gexec
DROP SCHEMA plans;