Incorrect generation of changelog in Liquibase - No function matches… You might need to add explicit type casts.(liquibase + spring.boot)

I used the generate the command - changeLogcommand, to upload the data, and use the resulting file as a changelog.

liquibase generateChangeLog

I use PostgreSql 11.x

  • db.changelog-master.xml

    <include file="db/changelog/xml/db/changelog-1.xml"/>


<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="" xmlns:ext="" xmlns:pro="" xmlns:xsi="" xsi:schemaLocation="">
    <changeSet author="IT (generated)" id="1609684188168-1">
        <createTable remarks="Aircrafts (internal data)" tableName="aircrafts_data">
            <column name="aircraft_code" remarks="Aircraft code, IATA" type="CHAR(3)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="aircrafts_pkey"/>
            <column name="model" remarks="Aircraft model" type="JSONB">
                <constraints nullable="false"/>
            <column name="range" remarks="Maximal flying distance, km" type="INTEGER">
                <constraints nullable="false"/>
    <changeSet author="IT (generated)" id="1609684188168-2">


    <changeSet author="IT (generated)" id="1609684188168-9">
        <createView fullDefinition="false" remarks="Aircrafts" viewName="aircrafts">SELECT ml.aircraft_code,
            (ml.model -&gt;&gt; lang()) AS model,
            FROM aircrafts_data ml;</createView>

  • pom.xml

enter image description here

Then I would like to apply the resulting file to the created project. But an error appears on startup.

Caused by: liquibase. exception.Migration Failed Exception: migration
failed for dB/change set / in XML format/dB / change-1. XML module::
1609684188168-9: yes (automatically): Reason: liquibase. exception.
DatabaseException: ERROR: the lang () function does not exist Hint: No
function matches the specified name and argument types. You may need
to add explicit type casts. Position: 84 [not in SQL: (0) creating a
public view.aircraft, how to select ml. aircraft_code, (ml. model - >

lang()) as the ml. range model From aircraft_data ml;]

  • lang
create function lang() returns text
    language plpgsql
  RETURN current_setting('bookings.lang');
  WHEN undefined_object THEN

alter function lang() owner to postgres;

As I understand it, the generator could not also transfer the function to changelog.xml, as well as views.

When I used that


I have got the errors:

[2021-01-03 18:51:02] SEVERE [liquibase.integration] Unexpected error
running Liquibase: Java heap space java.lang.OutOfMemoryError: Java
heap space
at java.base/java.lang.StringUTF16.compress(
at java.base/java.lang.String.(
at java.base/java.lang.String.(
at org.postgresql.core.OptimizedUTF8Encoder.charDecode(
at org.postgresql.core.ByteOptimizedUTF8Encoder.decode(
at org.postgresql.core.Encoding.decode(
at org.postgresql.jdbc.PgResultSet.getString(
at org.postgresql.jdbc.PgResultSet.internalGetObject(
at org.postgresql.jdbc.PgResultSet.getObject(
at liquibase.util.JdbcUtils.getResultSetValue(
at liquibase.diff.output.changelog.core.MissingDataChangeGenerator.fixMissing(
at liquibase.diff.output.changelog.ChangeGeneratorChain.fixMissing(
at liquibase.diff.output.changelog.ChangeGeneratorFactory.fixMissing(
at liquibase.diff.output.changelog.DiffToChangeLog.generateChangeSets(
at liquibase.diff.output.changelog.DiffToChangeLog.printNew(
at liquibase.diff.output.changelog.DiffToChangeLog$
at liquibase.Scope.lambda$child$0(
at liquibase.Scope$$Lambda$42/ Source)
at liquibase.Scope.child(
at liquibase.Scope.child(
at liquibase.Scope.child(
at liquibase.diff.output.changelog.DiffToChangeLog.print(
at liquibase.diff.output.changelog.DiffToChangeLog.print(
at liquibase.command.AbstractCommand.execute(
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(
at liquibase.integration.commandline.Main.doMigration(
at liquibase.integration.commandline.Main$1.lambda$run$0(
at liquibase.integration.commandline.Main$1$$Lambda$41/
at liquibase.Scope.lambda$child$0(
at liquibase.Scope$$Lambda$42/ Source)
at liquibase.Scope.child(

Then I removed the - data type. The file was generated without errors (data -had to be deleted. The error was possible due to the fact that it was necessary to check a large amount of data).

But I still don’t see the - lang() function there.

As I understand it, there should be something like: create function

How can I configure the generation to avoid such errors in the future, and how can I fix it manually ?

Hi @sky-alex ,

What version of Liquibase are you using? Also are you using Community or Pro?

Thanks for all the info you included!