Проверка схемы существует Postgresql
SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'name';
Foolish Falcon
SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'name';