Discussion:
[Liquibase-user] New Topic: update column with empty string sets a <null> value (trunk)
Liquibase Community Forum
2010-11-10 16:25:54 UTC
Permalink
A new topic, 'update column with empty string sets a <null> value (trunk)', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=779.new#new

The text of the topic is shown below:

Hi,

We use empty strings in our database and whle searching the forum I found some threads that discussed this topic. So now, we use the current trunk version and the insert statements (and defaultValues) are [correctly] set to empty strings instead of <null>.

But when I use the update tag, still <null> is used and not the empty string.

Example:
Code:
?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

<changeSet id="constraint_values/1009/1" author="me" dbms="postgresql">

<update tableName="mytable">
<column name="label" value=""/>
</update>

<insert tableName="mytable">
<column name="label" value="" />
</insert>
</changeSet>
</databaseChangeLog>


is converted to
Code:
UPDATE mytable SET label = NULL;

INSERT INTO mytable (label) VALUES ('');


I'd say those two tags should behave the same, shouldn't they? Is there any "workaround" or other path that lets me update a column with an empty string?

Thanks in advance

Regards,
Eike

Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.

Loading...