Using replaceIfExists with <createView> generates DROP statements

Description

The docs state that replaceIfExists uses 'create or replace' syntax. http://www.liquibase.org/documentation/changes/create_view.html

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: (http://www.postgresql.org/docs/9.3/static/sql-createview.html)

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.

Environment

Multiple views referencing each other.

Status

Assignee

Unassigned

Reporter

Rusi Filipov

Labels

None

Components

Fix versions

Affects versions

3.1.1

Priority

Major
Configure