Skip to content

Commit

Permalink
Fix query for snapshotting views on DB2/Z (#2712)
Browse files Browse the repository at this point in the history
DB2/Z: The view definition may only be fetched by the name and creator. The search with PATHSCHEMAS is ambiguous and may lead to multiple results.

Fix issue 2710
  • Loading branch information
michaelmatthiaskern committed Jul 28, 2022
1 parent 7e825f5 commit 46ccde7
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -27,7 +27,7 @@ public Sql[] generateSql(GetViewDefinitionStatement statement, Database database

if (database instanceof Db2zDatabase) {
return new Sql[] {
new UnparsedSql("select STATEMENT AS view_definition from SYSIBM.SYSVIEWS where NAME='" + statement.getViewName() + "' and (PATHSCHEMAS LIKE '%" + schema.getSchemaName() + "%' OR CREATOR = '" + schema.getSchemaName() + "')")
new UnparsedSql("select STATEMENT AS view_definition from SYSIBM.SYSVIEWS where NAME='" + statement.getViewName() + "' and CREATOR = '" + schema.getSchemaName() + "'")
};
}
return new Sql[] {
Expand Down

0 comments on commit 46ccde7

Please sign in to comment.