Postgresql: Check if Schema Exists?

前端 未结 10 1568
星月不相逢
星月不相逢 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:53

    If you want to create a schema if it doesn't exist you can just execute:

    CREATE SCHEMA IF NOT EXISTS foo
    

    Source: https://www.postgresql.org/docs/current/sql-createschema.html

提交回复
热议问题