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

loadData fails to insert data when usePreparedStatements=true #1551

Closed
neupsh opened this issue Nov 19, 2020 · 6 comments
Closed

loadData fails to insert data when usePreparedStatements=true #1551

neupsh opened this issue Nov 19, 2020 · 6 comments

Comments

@neupsh
Copy link
Contributor

neupsh commented Nov 19, 2020

Environment

Liquibase Version: 4.2.0 (also reproducible in 4.1.1)

Liquibase Integration & Version: spring boot, but is reproducible by cli (see below)

Liquibase Extension(s) & Version:

Database Vendor & Version: postgres:10.7

Operating System Type & Version:

Description

loadData change type fails to insert data when usePreparedStatements=true. The update operation completes without any error.

Steps To Reproduce

I have tried to simplify the steps to reproduce using cli instead of spring boot integration.

  • Database Setup (if not already available)
    Execute the following to run a temporary postgres docker:
docker run -it -e POSTGRES_PASSWORD=password postgres:10.7-alpine
  • A csv file to load data from: app_user.csv with the following content:
"id","name"
"1","John"
"2","Doe"
  • A changelog.xml with the following changesets:
    <changeSet id="1-createTable" author="neupsh">
      <createTable tableName="app_user">
          <column name="id" type="int"/>
          <column name="name" type="varchar(255)"/>
      </createTable>
    </changeSet>

    <changeSet id="2-loadData" author="neupsh">

        <loadData commentLineStartsWith="#" encoding="UTF-8" file="app_user.csv" quotchar="&quot;" relativeToChangelogFile="true" separator="," tableName="app_user" usePreparedStatements="true">
            <column header="id" name="id" type="NUMERIC"/>
            <column header="name" name="name" type="STRING"/>
        </loadData>
    </changeSet>
  • correct liquibase.properties pointing to the postgres db listed above
  • run liquibase update

Actual Behavior

  • Liquibase update is successful
  • app_user table is created
  • app_user table is empty
  • databasechangelog table has both changesets executed

Expected/Desired Behavior

  • Liquibase update is successful
  • app_user table is created
  • app_user table is populated with the contents from csv file
  • databasechangelog table has both changesets executed

If I change the usePreparedStatements="true" to usePreparedStatements="false" in the loadData changesets, the data is populated correctly.
I have attached the sample project to reproduce. Please modify the drivers location to execute it.
postgres.zip

@tomjo
Copy link

tomjo commented Jan 22, 2021

We have also encountered this issue with Liquibase version 3.10.3 which was pulled in by Spring Boot since Spring Boot version 2.4.1.

@vmarcinko
Copy link

We also experienced the same with Liquibase 4.7.1 and MySQL and mysql-connector-java JDBC driver 8.0.25. Everything works well when usePreparedStatements="false"

@kflorian
Copy link

Can still confirm this issue with MariaDB 10.7.1 and liquibase version 4.8.0.

@aaron-splicer
Copy link

ditto for similar mariadb and liquibase v. 4.9.0

@heneke
Copy link

heneke commented Apr 27, 2022

The cause of this issue is described here: a50e90b

@FBurguer
Copy link

FBurguer commented Oct 7, 2022

Look like it got fixed for liquibase 4.16.1. Im closing this issue, but if the issue continues to happen to you, please reopen the issue and let us know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

8 participants