Skip to content
This repository was archived by the owner on Apr 16, 2022. It is now read-only.

Commit 4a6db9f

Browse files
committed
retain owner on modify view
altering views is doe through DROP/CREATE so the owner information needs to persist even if the view existed in the old schema
1 parent 0b89ebe commit 4a6db9f

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/main/java/cz/startnet/utils/pgdiff/PgDiffViews.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static void createViews(final PrintWriter writer,
4040
searchPathHelper.outputSearchPath(writer);
4141
writer.println();
4242
writer.println(newView.getCreationSQL());
43-
if (newView.getOwnerTo() != null && oldView == null) {
43+
if (newView.getOwnerTo() != null) {
4444
writer.println();
4545
writer.println("ALTER VIEW "
4646
+ PgDiffUtils.getQuotedName(newView.getName())

src/test/resources/cz/startnet/utils/pgdiff/modify_materialized_view_diff.sql

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ DROP MATERIALIZED VIEW IF EXISTS testview;
33

44
CREATE MATERIALIZED VIEW testview AS
55
SELECT testtable.name, testtable.id FROM testtable;
6+
7+
ALTER VIEW testview OWNER TO fordfrog;

src/test/resources/cz/startnet/utils/pgdiff/modify_view_diff.sql

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ DROP VIEW IF EXISTS testview;
33

44
CREATE VIEW testview AS
55
SELECT testtable.name, testtable.id FROM testtable;
6+
7+
ALTER VIEW testview OWNER TO fordfrog;

0 commit comments

Comments
 (0)