Search code examples
liquibaseampersand

Adding ampersand in liquibase default value field


I need add a default value for a column in liquibase changeset.

<changeSet id="1">
        <insert tableName="table_name">
            <column name="column_name" value="value1 & value2"/>
        </insert>
</changeSet>

Since liquibase treats ampersand '&' as special character, it marks it as an error. What is the escape character for & in liquibase?


Solution

  • Realised the escape character would be same as the one used in any other XML based document since liquibase is XML based.

    i.e the escape character is &amp;

    Reference - stackoverflow.com/questions/12524908/how-to-escape-in-xml

    P.S answering my own question but feel it would be useful for others looking for the same info.