Postgresql: Check if Schema Exists?

前端 未结 10 1564
星月不相逢
星月不相逢 2021-02-01 12:24

I need to create, manage and drop schemas on the fly. If I go to create a schema that already exists, I want to (conditionally, via external means) drop and recreate it as speci

10条回答
  •  不思量自难忘°
    2021-02-01 12:28

    The following query will tell you whether a schema exists.

    SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'name';
    

提交回复
热议问题