Skip to content

Commit

Permalink
PG: create materialized view DDL fix
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed Mar 14, 2019
1 parent 0936167 commit 0d5ab23
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -103,7 +103,11 @@ protected void createOrReplaceViewQuery(DBRProgressMonitor monitor, List<DBEPers
String sql = view.getSource().trim();
if (!sql.toLowerCase(Locale.ENGLISH).startsWith("create")) {
StringBuilder sqlBuf = new StringBuilder();
sqlBuf.append("CREATE OR REPLACE ").append(view.getViewType()).append(" ").append(DBUtils.getObjectFullName(view, DBPEvaluationContext.DDL));
sqlBuf.append("CREATE ");
if (!(view instanceof PostgreMaterializedView)) {
sqlBuf.append("OR REPLACE ");
}
sqlBuf.append(view.getViewType()).append(" ").append(DBUtils.getObjectFullName(view, DBPEvaluationContext.DDL));
appendViewDeclarationPrefix(monitor, sqlBuf, view);
sqlBuf.append("\nAS ").append(sql);
appendViewDeclarationPostfix(monitor, sqlBuf, view);
Expand Down

0 comments on commit 0d5ab23

Please sign in to comment.