Hello, everybody!
What if someone has information on the subject? Please, if you know, don’t be silent.
There is a file XXX.json, the data of which must be saved in the field field_with_json_type of the table YYY of the postgresql database.
Changset looks like this:
<changeSet>
...
<insert tableName="YYY">
...
<column name="field_with_json_type" valueClobFile="XXX.json"/>
...
</insert>
I get a mistake:
org.postgresql.util.PSQLException: ERROR: column “field_with_json_type” is of type json but expression is of type character varying
I can’t believe it is there no way to tell liquibase that the column data type is json?
Or do you want the content of the file to type ::json?
aditi
October 12, 2021, 2:35pm
2
Hi @Barshay ,
I recreated your setting and I am able to deploy the json file in the changeset successfully. Please take a look at the below working changeset.
<changeSet id="table1" author="amalik" labels="4.1.1">
<createTable tableName="table1">
<column name="field_with_json_type" type="text"/>
</createTable>
</changeSet>
<changeSet id="forum1" author="aditi">
<insert tableName="table1">
<column name="field_with_json_type" valueClobFile="schemaBackup.json"/>
</insert>
</changeSet>
Barshay
October 13, 2021, 10:17am
3
aditi:
field_with_json_type
Hi!
Please, pay attantion, that in my case field “field_with_json_type” has strong json type, like this:
field_with_json_type json NULL
Finally, I solved my case through an intermediate table with a field of the type “text”.
Anyway, thank you!