Using replaceIfExists with <createView> generates DROP statements


The docs state that replaceIfExists uses 'create or replace' syntax.

In 3.1.1 the built-in Liquibase attribute <createView ... replaceIfExists="true"> does not produce the CREATE OR REPLACE VIEW statement. Instead uses two statements - DROP VIEW and then CREATE VIEW, which is not equivalent as described below.

In order to update already existing view without disrupting any references, the best strategy is to use CREATE OR REPLACE VIEW. Note that this statement is not equivalent to dropping and creating the view with two statements, because the DROP statement does either fail when references to the view are present, or it might drop the references with CASCADE.

From the PostgreSQL docs: (

When CREATE OR REPLACE VIEW is used on an existing view, only the view's
defining SELECT rule is changed. Other view properties, including ownership,
permissions, and non-SELECT rules, remain unchanged.


Multiple views referencing each other.


Rusi Filipov


Fix versions

Affects versions