# What is best practice for null values in CSV files?

**URL:** <https://forum.liquibase.org/t/what-is-best-practice-for-null-values-in-csv-files/10962>\
**Category:** General Discussion\
**Created:** [October 3, 2026, 10:39am UTC](https://forum.liquibase.org/t/what-is-best-practice-for-null-values-in-csv-files/10962 "2026-10-03T10:39:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteinarBang](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SteinarBang](https://forum.liquibase.org/u/SteinarBang)\
**Post date:** [October 3, 2026, 10:39am UTC](https://forum.liquibase.org/t/what-is-best-practice-for-null-values-in-csv-files/10962/1 "2026-10-03T10:39:42Z")

</div>

What is the best practice for handling null values in CSV files that is to be imported with `<loadData>`?

I googled on beforehand and used an empty field, i.e. nothing between the commas.

But that gave me problems when I tried to use a dumped CSV to restore a table in a JUnit test, using derby as the in-memory database:  
`The data type '0' is not supported`

I managed to fix this problem for numeric and boolean columns by setting nullPlaceHolder to the empty string  
`<column name="CONTENTLENGTH" type="NUMERIC" nullPlaceholder=""/> <column name="REQUIRE_LOGIN" type="BOOLEAN" nullPlaceholder=""/> <column name="GROUP_BY_YEAR" type="BOOLEAN" nullPlaceholder=""/>`

But trying to set this on a string column gives me the derby failure `The data type '0' is not supported` again  
`<column name="CONTENTTYPE" type="STRING" nullPlaceholder=""/>`

I would like my dumped CSV files to work as well out of the box as possible with whatever tools uses them, be it excel or a database import or setting up a mockrunner result set.  
But my primary usage will be using liquibase to load the CSV into a table.  
So, what is liquibase best practice for saving null values to CSV files?  
Is best practice different depending on the column type?  
Is best practice different depending on the target RDBMS?

Thanks!

- Steinar

---

<div class="post-metadata">

**Author:** ![colorfulcms](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@colorfulcms](https://forum.liquibase.org/u/colorfulcms)\
**Post date:** [October 29, 2026, 3:18pm UTC](https://forum.liquibase.org/t/what-is-best-practice-for-null-values-in-csv-files/10962/2 "2026-10-29T15:18:46Z")

</div>

Hi Steinar, I ran into something very similar when dumping seed data for tests.

What worked best for me was to not rely on empty fields at all and instead write an explicit token for null in the CSV. loadData already treats the literal string NULL as null by default (that’s the default nullPlaceholder), so if your dump writes NULL for null cells and leaves empty fields only for real empty strings, you keep the difference between ‘’ and null, which an empty field can’t express for text columns.

The “data type ‘0’ is not supported” message looks like Derby rejecting a setNull call made with the generic NULL SQL type, which tends to happen when Liquibase can’t map the column type. I’d try declaring the string columns with a concrete type such as VARCHAR instead of STRING (and NUMERIC/BOOLEAN as you did) so it binds a typed null. That’s a hunch from my own Derby tests, so worth checking on your setup.

For Excel and other tools, NULL as a visible token is also easier to spot than an empty cell. So my rule of thumb: one explicit null token everywhere, explicit column types in loadData, and only rely on per-RDBMS differences if a specific driver complains.

---

<div class="post-metadata">

**Author:** ![williamnelson](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@williamnelson](https://forum.liquibase.org/u/williamnelson)\
**Post date:** [November 6, 2026, 1:18pm UTC](https://forum.liquibase.org/t/what-is-best-practice-for-null-values-in-csv-files/10962/3 "2026-11-06T13:18:42Z")

</div>

The generic SQL type is likely what Derby is objecting to, so declaring the string column as VARCHAR rather than STRING should let Liquibase bind a typed null instead of calling setNull with the untyped variant. Worth checking whether your dump writes quoted empty strings for real empty values and unquoted NULL for absent ones, since that distinction matters more for text than for numeric or boolean columns. I’d also verify how the mockrunner result set interprets the token before settling on one convention across all your CSV files.
