====== Смена пользователя БД в postgresql ====== DO $$ DECLARE tbl RECORD; BEGIN -- Loop through each table in the specified schemes FOR tbl IN SELECT tablename,schemaname FROM pg_catalog.pg_tables WHERE schemaname in ( 'api', 'help', 'hotel', 'log', 'public', 'samosad', 'whatsapp') -- Добавьте ваши схемы в список LOOP -- Alter the owner of each table EXECUTE 'ALTER TABLE ' || quote_ident(tbl.schemaname) || '.' || quote_ident(tbl.tablename) || ' OWNER TO diman'; -- Replace all your schemes and 'diman' with the new owner's name END LOOP; END; $$;