question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

valueComputed does not work with valueBlobFile

See original GitHub issue

Environment

Liquibase Version: 3.8.9

Liquibase Integration & Version: Gradle

Liquibase Extension(s) & Version:

Database Vendor & Version: PosgreSQL 10

Operating System Type & Version: Windows 10

Description

If I put in <insert> change insert to table with two columns: valueComputed and valueBlobFile, Liquibase always tries to insert null to valueComputed whatever I put in this attribute value.

Steps To Reproduce

  • Create table with columns of types uuid and bytea.
  • Create migration with <insert> change.
  • In that migration fill columns with valueComputed="uuid_in(md5(random()::text || clock_timestamp()::text)::cstring)" and valueBlobFile="path/to/file"

Changeset that reproduces the issue <changeSet author="mike" id="1"> <createTable tableName="TABLE_WITH_CLOB"> <column name="ID" type="java.sql.Types.BIGINT" autoIncrement="true"> <constraints nullable="false" primaryKey="true" /> </column> <column name="CONTENT" type="java.sql.Types.CLOB"> <constraints nullable="false" /> </column> <column name="UUIDCOL" type="uuid" /> </createTable> </changeSet> <changeSet author="mike" id="2"> <insert tableName="TABLE_WITH_CLOB"> <column name="ID" valueNumeric="1" /> <column name="CONTENT" valueClobFile="test-clob.txt" /> <column name="UUIDCOL" valueComputed="uuid_in(md5(random()::text || clock_timestamp()::text)::cstring)" /> </insert> </changeSet> <changeSet author="mike" id="3"> <update tableName="TABLE_WITH_CLOB"> <column name="UUIDCOL" valueComputed="uuid_in(md5(random()::text || clock_timestamp()::text)::cstring)" /> </update> </changeSet>

Actual Behavior

Liquibase migration crashes with message null value in column "id" violates not-null constraint

Expected/Desired Behavior

Migration passes successfully.

P.S.

I’ve found the related bug report here

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mitasov-racommented, May 19, 2020

Seems like I won’t get any feedback here 😕

0reactions
MalloD12commented, Aug 15, 2022

I cannot reproduce this issue on below environment:

Liquibase Version: 4.15.0

Liquibase Integration & Version: Liquibase CLI

Database Vendor & Version: PosgreSQL 14

Operating System Type & Version: Mac OS 12.1 

With below changelog:

<changeSet author="daniel" id="1">
        <createTable tableName="TABLE_WITH_CLOB">
            <column name="ID" type="java.sql.Types.BIGINT" autoIncrement="true">
                <constraints nullable="false" primaryKey="true" />
            </column>
            <column name="CONTENT" type="java.sql.Types.CLOB">
                <constraints nullable="false" />
            </column>
            <column name="UUIDCOL" type="uuid" />
        </createTable>
    </changeSet>
    <changeSet author="daniel" id="2">
        <insert tableName="TABLE_WITH_CLOB">
            <column name="ID" valueNumeric="1" />
            <column name="CONTENT" valueClobFile="test-clob.txt" />
            <column name="UUIDCOL" valueComputed="uuid_in(md5(random()::text || clock_timestamp()::text)::cstring)" />
        </insert>
    </changeSet>
    <changeSet author="daniel" id="3">
        <update tableName="TABLE_WITH_CLOB">
            <column name="UUIDCOL" valueComputed="uuid_in(md5(random()::text || clock_timestamp()::text)::cstring)" />
        </update>
    </changeSet>

and cannot reproduce this issue. Changelog execution output is as displayed below:

Starting Liquibase at 14:04:45 (version 4.15.0 #4001 built at 2022-08-05 16:17+0000)
Liquibase Version: 4.15.0
Liquibase Community 4.15.0 by Liquibase
Running Changeset: issue1149.xml::1::daniel
Running Changeset: issue1149.xml::2::daniel
Running Changeset: issue1149.xml::3::daniel
Liquibase command 'update' was executed successfully.
Read more comments on GitHub >

github_iconTop Results From Across the Web

now() function is not working with valueBlobFile in liquibase
For mysql you can use the following: <insert tableName="image"> <column name="body" value="LOAD_FILE(image/logo.png)" /> <column ...
Read more >
Is there a way to add value from one query to another in xml ...
valueComputed A value that is returned from a function or procedure call. This attribute will contain the function to call.
Read more >
ColumnConfig (liquibase-root 4.2.2 API) - javadoc.io
It is not required that a column-based Change uses this class, but parsers should ... Return the function whose value should generate this...
Read more >
column | Liquibase Docs
Note: Because the <column> tag has multiple uses, not every attributes is ... valueComputed, The value that is returned from a function or...
Read more >
ColumnConfig (Liquibase Core 3.0.7 API) - Javadoc Extreme
It is not required that a column-based Change uses this class, but parsers should look for ... private String valueBlobFile; private String valueClobFile; ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found