loadData fails to insert data when usePreparedStatements=true
See original GitHub issueEnvironment
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=""" 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 createdapp_user
table is emptydatabasechangelog
table has both changesets executed
Expected/Desired Behavior
- Liquibase update is successful
app_user
table is createdapp_user
table is populated with the contents from csv filedatabasechangelog
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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
Load data local infile not inserting into database
Login to your SSH prompt. Then type # mysql -u admin -p`cat /etc/psa/.psa.shadow`; mysql>LOAD DATA LOCAL INFILE 'File.csv' INTO TABLE table FIELDS ...
Read more >loadData | Liquibase Docs
Loads data from a CSV file into an existing table when you add it to your changelog. Uses. A value of NULL in...
Read more >LOAD DATA INFILE vs. INSERT in MySQL: Why, How, When?
This article will demonstrate the differences between LOAD DATA INFILE and INSERT and explain when you should use both for data entry in...
Read more >MySQL 8.0 Reference Manual :: 13.2.9 LOAD DATA Statement
LOAD DATA supports explicit partition selection using the PARTITION clause with a list of one or more comma-separated names of partitions, subpartitions, or ......
Read more >SaveData, LoadData, and ClearData functions in Power Apps
Caching data in the App.OnStart formula on a first run. Reloading the local cache on next runs. You can also use these functions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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”
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!