lbitonti / liquibase-hana

Liquibase Hana extension
Apache License 2.0
11 stars 11 forks source link

Generated SQL statement for GetViewDefinitionStatement does not consider Schema #12

Closed tomheisner closed 7 years ago

tomheisner commented 7 years ago

Table VIEWS of SYS schema holds View Definitions. We can have the same view in multiple schemas.

Liquibase Core expects exaclty one result entry from the View Exists sql statement.

As this code does not consider the Schema, an error is raised, in case the same view really exists in multiple schemas, and is therefore returned as multiple instances as part of hte result set.

Proposal: Add Schema to the select: Current Code: new UnparsedSql("SELECT DEFINITION FROM VIEWS WHERE upper(VIEW_NAME)='" + statement.getViewName().toUpperCase() + "'")

Proposal: new UnparsedSql("SELECT DEFINITION FROM VIEWS WHERE upper(SCHEMA_NAME) = '" + statement.getSchemaName().toUpperCase() + "' AND upper(VIEW_NAME) = '" + statement.getViewName().toUpperCase() + "'")

Definition of VIEWS Table in HANA https://help.sap.com/doc/4fe29514fd584807ac9f2a04f6754767/2.0.02/en-US/2102bf28751910149d0a817a65699956.html

Code: https://github.com/lbitonti/liquibase-hana/blob/master/src/main/java/liquibase/sqlgenerator/ext/GetViewDefinitionGeneratorHanaDB.java

lbitonti commented 7 years ago

Hi Tom,

Thanks for reporting that. If you create a pull request for your change I'll merge it.

Cheers, Luigi

tomheisner commented 7 years ago

@lbitonti can you please provide write access to the repo? Will then provide the adjustment as a separate pullrequest/branch. Thanks Tom!

tomheisner commented 7 years ago

Hi Luigi,Can you please provide write access for me?Thanks,Tom

Gesendet von Yahoo Mail für iPhone

Am Dienstag, November 7, 2017, 10:42 AM schrieb Luigi Bitonti notifications@github.com:

Hi Tom,

Thanks for reporting that. If you create a pull request for your change I'll merge it.

Cheers, Luigi

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

lbitonti commented 7 years ago

Hi Tom,

You don't need write access to create a PR. Simply fork the repo and then follow this:

https://help.github.com/articles/creating-a-pull-request-from-a-fork/

Cheers, Luigi

tomheisner commented 7 years ago

Hi @lbitonti, please check PR (https://github.com/lbitonti/liquibase-hana/pull/13) Cheerz, Tom!

lbitonti commented 7 years ago

Hi Tom,

Merged and released in 3.1.1

Cheers, Luigi