org.postgresql.util.PSQLException: ERROR: relation 43416 deleted while still in use

hibernate.org | 4 months ago
  1. 0

    Hibernate Community • View topic - JUnit Test Cases Fail for PostgreSQL

    hibernate.org | 4 months ago
    org.postgresql.util.PSQLException: ERROR: relation 43416 deleted while still in use
  2. 0

    When you specify a default_scheme in the hibernate.cfg.xml the sequence generator doesn't respect the default_schema. Instead it uses the sequence in the "public" schema which is what PostgreSQL's schema search defaults to. Here is the generated SQL from when public.items_id_sequence exists: Hibernate: select nextval ('items_id_sequence') Hibernate: insert into beta2.items (name, id) values (?, ?) Note that the first line doens't specify a schema. Here is the generated SQL and following log lines when public.items_id_sequence doesn't exists: Hibernate: select nextval ('items_id_sequence') Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 0, SQLState: 42P01 Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "items_id_sequence" does not exist Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 0, SQLState: 42P01 Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "items_id_sequence" does not exist Sep 10, 2004 12:07:45 PM net.sf.hibernate.JDBCException <init> SEVERE: Could not save object org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:231) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at test.Something.main(Something.java:24) Exception in thread "main" net.sf.hibernate.JDBCException: Could not save object at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at test.Something.main(Something.java:24) Caused by: org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:231) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) ... 3 more After some debugging I found that the params passed into net.sf.hibernate.id.SequenceGenerator.configure(...) do not contain a property under the "schema" key, which seems to be why SequenceGenerator.generate(..) doesn't know about the schema.

    Hibernate JIRA | 1 decade ago | Sandy McArthur
    org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist
  3. 0

    When you specify a default_scheme in the hibernate.cfg.xml the sequence generator doesn't respect the default_schema. Instead it uses the sequence in the "public" schema which is what PostgreSQL's schema search defaults to. Here is the generated SQL from when public.items_id_sequence exists: Hibernate: select nextval ('items_id_sequence') Hibernate: insert into beta2.items (name, id) values (?, ?) Note that the first line doens't specify a schema. Here is the generated SQL and following log lines when public.items_id_sequence doesn't exists: Hibernate: select nextval ('items_id_sequence') Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 0, SQLState: 42P01 Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "items_id_sequence" does not exist Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 0, SQLState: 42P01 Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "items_id_sequence" does not exist Sep 10, 2004 12:07:45 PM net.sf.hibernate.JDBCException <init> SEVERE: Could not save object org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:231) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at test.Something.main(Something.java:24) Exception in thread "main" net.sf.hibernate.JDBCException: Could not save object at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at test.Something.main(Something.java:24) Caused by: org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:231) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) ... 3 more After some debugging I found that the params passed into net.sf.hibernate.id.SequenceGenerator.configure(...) do not contain a property under the "schema" key, which seems to be why SequenceGenerator.generate(..) doesn't know about the schema.

    Hibernate JIRA | 1 decade ago | Sandy McArthur
    org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Talk:FAQ - OpenNMS

    opennms.org | 1 year ago
    org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "node"

    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: relation 43416 deleted while still in use

      at org.postgresql.util.PSQLException.parseServerError()
    2. PostgreSQL JDBC Driver
      QueryExecutor.execute
      1. org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
      2. org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152)
      3. org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
      4. org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
      4 frames
    3. org.postgresql.jdbc1
      AbstractJdbc1Statement.execute
      1. org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:517)
      1 frame
    4. PostgreSQL JDBC Driver
      AbstractJdbc2Statement.execute
      1. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50)
      1 frame
    5. org.postgresql.jdbc1
      AbstractJdbc1Statement.executeQuery
      1. org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:233)
      1 frame
    6. net.sf.hibernate
      SessionImpl.saveOrUpdate
      1. net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69)
      2. net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765)
      3. net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
      4. net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388)
      4 frames
    7. org.hibernate.auction
      CategoryItemTest.testCompositeQuery
      1. org.hibernate.auction.dao.CategoryDAO.makePersistent(CategoryDAO.java:81)
      2. org.hibernate.auction.test.TestCaseWithData.initData(TestCaseWithData.java:51)
      3. org.hibernate.auction.test.CategoryItemTest.testCompositeQuery(CategoryItemTest.java:17)
      3 frames
    8. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    9. JUnit
      TestCase.runTest
      1. junit.framework.TestCase.runTest(TestCase.java:154)
      1 frame
    10. org.hibernate.auction
      TestCase.runTest
      1. org.hibernate.auction.test.TestCase.runTest(TestCase.java:17)
      1 frame
    11. JUnit
      TestSuite.run
      1. junit.framework.TestCase.runBare(TestCase.java:127)
      2. junit.framework.TestResult$1.protect(TestResult.java:106)
      3. junit.framework.TestResult.runProtected(TestResult.java:124)
      4. junit.framework.TestResult.run(TestResult.java:109)
      5. junit.framework.TestCase.run(TestCase.java:118)
      6. junit.framework.TestSuite.runTest(TestSuite.java:208)
      7. junit.framework.TestSuite.run(TestSuite.java:203)
      8. junit.framework.TestSuite.runTest(TestSuite.java:208)
      9. junit.framework.TestSuite.run(TestSuite.java:203)
      9 frames
    12. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
      3 frames