Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid update SQL generated for HSQL database in InsertOrUpdateGeneratorHsql.java #1562

Closed
devorgpl opened this issue Nov 27, 2020 · 1 comment · Fixed by #1563
Closed

Comments

@devorgpl
Copy link
Contributor

devorgpl commented Nov 27, 2020

Environment

Liquibase: all branches, verified on 4.2.x
Database Vendor: HSQL

Description

Invalid SQL generated for HSQL database in InsertOrUpdateGeneratorHsql.java

Note: Found when trying to use:

<loadUpdateData tableName="testtable"
                        primaryKey="id_pk"
                        relativeToChangelogFile="true"
                        onlyUpdate="true"
                        file="data.csv">
            <column name="column1" />
            <column name="column2" />
        </loadUpdateData>
  • no table name in update script
  • no where clause in update script
  • note: no tests for this file

Steps To Reproduce

package liquibase.sqlgenerator.core

import liquibase.database.core.HsqlDatabase
import liquibase.statement.core.InsertOrUpdateStatement
import spock.lang.Specification

class InsertOrUpdateGeneratorHsqlTest extends Specification {

    def 'should get correct update statement'() {
        given:
        def stat = new InsertOrUpdateStatement(null, null, "testtable", "id_pk", true)
        stat.addColumnValue("column1", "value1")
        stat.addColumnValue("column2", "value2")
        def where = "id_pk = '1'"

        when:
        def result = new InsertOrUpdateGeneratorHsql().getUpdateStatement(stat, new HsqlDatabase(), where, null)

        then:
        result == "UPDATE testtable SET column1 = 'value1',column2 = 'value2' where id_pk = '1'"
    }
}

Actual Behavior && Desired Behavior

result == "UPDATE testtable SET column1 = 'value1',column2 = 'value2' where id_pk = '1'"
|      |
|      false
|      28 differences (63% similarity)
|      UPDATE (----------)SET column1 = 'value1',column2 = 'value2'(------------------)
|      UPDATE (testtable )SET column1 = 'value1',column2 = 'value2'( where id_pk = '1')
UPDATE SET column1 = 'value1',column2 = 'value2'

@devorgpl devorgpl changed the title Invalid SQL generated for HSQL database in InsertOrUpdateGeneratorHsql.java Invalid update SQL generated for HSQL database in InsertOrUpdateGeneratorHsql.java Nov 27, 2020
@molivasdat
Copy link
Contributor

Thanks @devorgpl for writing up this issue and adding a PR to fix it. We will add this to the list of issues and PRs to process.

@molivasdat molivasdat linked a pull request Dec 2, 2020 that will close this issue
7 tasks
@nvoxland nvoxland added this to To Do in Conditioning++ via automation Jun 7, 2021
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Jun 7, 2021
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Jun 9, 2021
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Jul 29, 2021
@nvoxland nvoxland added this to the v4.4.3 milestone Aug 5, 2021
@nvoxland nvoxland removed this from Done in Conditioning++ Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants