liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png).

JIRA | Matthias Weiss | 2 years ago
  1. 0

    Using this statement to insert the binary data: {code:java} <insert tableName="webtools_file"> <column name="db_id" valueNumeric="271" /> <column name="db_created" valueDate="${now}" /> <column name="db_updated" valueDate="${now}" /> <column name="db_version" valueNumeric="1" /> <column name="content" valueBlobFile="icons/8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="filesize" valueNumeric="5867" /> <column name="filename" value="8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="hash" value="8f13b0edb57b156bf807f0e329afc76c" /> <column name="mimetype" value="image/png" /> </insert> {code} This works fine with Liquibase 3.2.3. But if we would like to set the primary key by database sequence like: {code:java} <insert tableName="webtools_file"> <column name="db_id" valueSequenceNext="database_version_seq" /> <column name="db_created" valueDate="${now}" /> <column name="db_updated" valueDate="${now}" /> <column name="db_version" valueNumeric="1" /> <column name="content" valueBlobFile="icons/8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="filesize" valueNumeric="5867" /> <column name="filename" value="8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="hash" value="8f13b0edb57b156bf807f0e329afc76c" /> <column name="mimetype" value="image/png" /> </insert> {code} or: {code:java} <insert tableName="webtools_file"> <column name="db_id" valueComputed="NEXTVAL('database_version_seq')" /> <column name="db_created" valueDate="${now}" /> <column name="db_updated" valueDate="${now}" /> <column name="db_version" valueNumeric="1" /> <column name="content" valueBlobFile="icons/8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="filesize" valueNumeric="5867" /> <column name="filename" value="8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="hash" value="8f13b0edb57b156bf807f0e329afc76c" /> <column name="mimetype" value="image/png" /> </insert> {code} The primary key will not be set. We got this exception: {code:java} SEVERE 28.04.15 10:54: liquibase: src/main/resources/liquibase/changelog-master.xml: src/main/resources/liquibase/changelog-2.0_test_data_set1_DONT_CHANGE.xml::test_data-file::ftr8fe: Change Set src/main/resources/liquibase/changelog-2.0_test_data_set1_DONT_CHANGE.xml::test_data-file::ftr8fe failed. Error: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png). liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png). at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:79) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:118) at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1206) at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1189) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:534) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:70) at liquibase.Liquibase.update(Liquibase.java:195) at liquibase.Liquibase.update(Liquibase.java:174) at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:31) at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:24) at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:367) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png). at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:413) at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:77) {code}

    JIRA | 2 years ago | Matthias Weiss
    liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png).
  2. 0

    Using this statement to insert the binary data: {code:java} <insert tableName="webtools_file"> <column name="db_id" valueNumeric="271" /> <column name="db_created" valueDate="${now}" /> <column name="db_updated" valueDate="${now}" /> <column name="db_version" valueNumeric="1" /> <column name="content" valueBlobFile="icons/8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="filesize" valueNumeric="5867" /> <column name="filename" value="8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="hash" value="8f13b0edb57b156bf807f0e329afc76c" /> <column name="mimetype" value="image/png" /> </insert> {code} This works fine with Liquibase 3.2.3. But if we would like to set the primary key by database sequence like: {code:java} <insert tableName="webtools_file"> <column name="db_id" valueSequenceNext="database_version_seq" /> <column name="db_created" valueDate="${now}" /> <column name="db_updated" valueDate="${now}" /> <column name="db_version" valueNumeric="1" /> <column name="content" valueBlobFile="icons/8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="filesize" valueNumeric="5867" /> <column name="filename" value="8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="hash" value="8f13b0edb57b156bf807f0e329afc76c" /> <column name="mimetype" value="image/png" /> </insert> {code} or: {code:java} <insert tableName="webtools_file"> <column name="db_id" valueComputed="NEXTVAL('database_version_seq')" /> <column name="db_created" valueDate="${now}" /> <column name="db_updated" valueDate="${now}" /> <column name="db_version" valueNumeric="1" /> <column name="content" valueBlobFile="icons/8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="filesize" valueNumeric="5867" /> <column name="filename" value="8f13b0edb57b156bf807f0e329afc76c.png" /> <column name="hash" value="8f13b0edb57b156bf807f0e329afc76c" /> <column name="mimetype" value="image/png" /> </insert> {code} The primary key will not be set. We got this exception: {code:java} SEVERE 28.04.15 10:54: liquibase: src/main/resources/liquibase/changelog-master.xml: src/main/resources/liquibase/changelog-2.0_test_data_set1_DONT_CHANGE.xml::test_data-file::ftr8fe: Change Set src/main/resources/liquibase/changelog-2.0_test_data_set1_DONT_CHANGE.xml::test_data-file::ftr8fe failed. Error: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png). liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png). at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:79) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:118) at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1206) at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1189) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:534) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:70) at liquibase.Liquibase.update(Liquibase.java:195) at liquibase.Liquibase.update(Liquibase.java:174) at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:31) at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:24) at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:367) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png). at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:413) at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:77) {code}

    JIRA | 2 years ago | Matthias Weiss
    liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png).
  3. 0

    PlainSQL: `sqlu` generates wrong DDL sql?

    GitHub | 2 years ago | tminglei
    org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1" Position: 88
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    PSQLException; No function matches given name and argument types

    Stack Overflow | 1 year ago | user1011376
    org.postgresql.util.PSQLException: ERROR: function create_new_user(bigint, character varying, character varying, character varying, character varying, unknown, character) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 15
  6. 0

    ERROR c.t.t.d.e.DefaultExecutorFactory - System executor exception

    GitHub | 1 year ago | zarmack
    com.torodb.torod.core.exceptions.ToroRuntimeException: java.lang.RuntimeException: org.jooq.exception.DataAccessException: SQL [{ ? = call "public"."reserve_doc_ids"(?, ?) }]; ERROR: function public.reserve_doc_ids(character varying, integer) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 15

  1. silex 16 times, last 4 weeks ago
  2. silex 1 times, last 5 months ago
10 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.postgresql.util.PSQLException

    ERROR: null value in column "db_id" violates not-null constraint Detail: Failing row contains (null, null, null, 1, \x89504e470d0a1a0a0000000d49484452000000b1000000b108060000008b29..., 5867, 8f13b0edb57b156bf807f0e329afc76c.png, 8f13b0edb57b156bf807f0e329afc76c, image/png).

    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse()
  2. PostgreSQL JDBC Driver
    AbstractJdbc2Statement.execute
    1. org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
    2. org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
    3. org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    4. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
    5. org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420)
    6. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:413)
    6 frames
  3. Liquibase Core
    ExecutablePreparedStatementBase.execute
    1. liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:77)
    1 frame