Idempotent PostgreSQL DDL scripts

后端 未结 3 1583
日久生厌
日久生厌 2021-02-08 12:04

I\'m looking for a way to script postgreSQL schema changes in an idempotent manner.

In MSSQL I could do something like this:

if(not exists(select * from          


        
3条回答
  •  面向向阳花
    2021-02-08 12:37

    You should be able to use plpgsql:

    create language plpgsql;
    create function f() ... as $$
    
    $$language plpgsql;
    select f();
    

提交回复
热议问题