org.postgresql.util.PSQLException: ERROR: insert or update on table "epersongroup2workspaceitem" violates foreign key constraint "epersongroup2workspaceitem_workspace_item_id_fkey" Detail: Key (workspace_item_id)=(-1) is not present in table "workspaceitem".

Sakai JIRA | Jonathan Blood | 4 years ago
  1. 0

    If you attempt to add a supervisor order when no workflow exists then this throws an internal error. Exception: org.postgresql.util.PSQLException: ERROR: insert or update on table "epersongroup2workspaceitem" violates foreign key constraint "epersongroup2workspaceitem_workspace_item_id_fkey" Detail: Key (workspace_item_id)=(-1) is not present in table "workspaceitem". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.dspace.storage.rdbms.DatabaseManager.execute(DatabaseManager.java:1429) at org.dspace.storage.rdbms.DatabaseManager.update(DatabaseManager.java:781) at org.dspace.eperson.Supervisor.add(Supervisor.java:191) at org.dspace.app.webui.servlet.admin.SuperviseServlet.addSupervisionOrder(SuperviseServlet.java:242) at org.dspace.app.webui.servlet.admin.SuperviseServlet.doDSPost(SuperviseServlet.java:111) at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:147) at org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.dspace.app.webui.filter.AdminOnlyFilter.doFilter(AdminOnlyFilter.java:103) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:429) at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555) at java.lang.Thread.run(Thread.java:679) Steps to reproduce: 1. Login with admin account. 2. Navigate to the Dspace admin page (<dspaceurl>/dspace-admin/) 3. Click supervisors link. 4. Click "Add a Supervision Order" button 5. Click "Submit Supervision Order" button I managed to reproduce this issue on Dspace 1.6.2 and Dspace3.0 RC 3. I have't tested if this issue occurs on any other versions of Dspace. I have created a fix for this issue. I've attached a patch with the fix.

    Sakai JIRA | 4 years ago | Jonathan Blood
    org.postgresql.util.PSQLException: ERROR: insert or update on table "epersongroup2workspaceitem" violates foreign key constraint "epersongroup2workspaceitem_workspace_item_id_fkey" Detail: Key (workspace_item_id)=(-1) is not present in table "workspaceitem".
  2. 0

    If you attempt to add a supervisor order when no workflow exists then this throws an internal error. Exception: org.postgresql.util.PSQLException: ERROR: insert or update on table "epersongroup2workspaceitem" violates foreign key constraint "epersongroup2workspaceitem_workspace_item_id_fkey" Detail: Key (workspace_item_id)=(-1) is not present in table "workspaceitem". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.dspace.storage.rdbms.DatabaseManager.execute(DatabaseManager.java:1429) at org.dspace.storage.rdbms.DatabaseManager.update(DatabaseManager.java:781) at org.dspace.eperson.Supervisor.add(Supervisor.java:191) at org.dspace.app.webui.servlet.admin.SuperviseServlet.addSupervisionOrder(SuperviseServlet.java:242) at org.dspace.app.webui.servlet.admin.SuperviseServlet.doDSPost(SuperviseServlet.java:111) at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:147) at org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.dspace.app.webui.filter.AdminOnlyFilter.doFilter(AdminOnlyFilter.java:103) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:429) at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555) at java.lang.Thread.run(Thread.java:679) Steps to reproduce: 1. Login with admin account. 2. Navigate to the Dspace admin page (<dspaceurl>/dspace-admin/) 3. Click supervisors link. 4. Click "Add a Supervision Order" button 5. Click "Submit Supervision Order" button I managed to reproduce this issue on Dspace 1.6.2 and Dspace3.0 RC 3. I have't tested if this issue occurs on any other versions of Dspace. I have created a fix for this issue. I've attached a patch with the fix.

    Sakai JIRA | 4 years ago | Jonathan Blood
    org.postgresql.util.PSQLException: ERROR: insert or update on table "epersongroup2workspaceitem" violates foreign key constraint "epersongroup2workspaceitem_workspace_item_id_fkey" Detail: Key (workspace_item_id)=(-1) is not present in table "workspaceitem".
  3. 0

    [Dspace-tech] handle-server setup

    Google Groups | 7 years ago | Lewatle Phaladi
    org.postgresql.util.PSQLException: ERROR: more than one row returned by a subquery used as an expression
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hello , this is my first post for DSPACE . I am trying to Moving items ( 5000) from diffent collections under diffent communites to under one community and diffent collections ?? what is the best method to do this ? i treid these two SQL scripts but now getting error for reindex update item set owning_collection=NewCollectionID where item_id=ItemID; update collection2item set collection_id=new collection it where collection_id= old collection; once it run these two scripts i can see total number of items by title under new collections but can't see them under new community . i tried to update this table communities2item , then its showing total number of items under community as well as differnt collections but when i am trying to reindexing getting this error message ./dspace index-update Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey" org.dspace.browse.BrowseException: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey" at org.dspace.browse.BrowseCreateDAOPostgres.updateCommunityMappings(BrowseCreateDAOPostgres.java:661) at org.dspace.browse.IndexBrowse.indexItem(IndexBrowse.java:402) at org.dspace.browse.IndexBrowse.createIndex(IndexBrowse.java:1148) at org.dspace.browse.IndexBrowse.main(IndexBrowse.java:703) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:212) Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey" at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.dspace.storage.rdbms.DatabaseManager.execute(DatabaseManager.java:1429) at org.dspace.storage.rdbms.DatabaseManager.insert(DatabaseManager.java:736) at org.dspace.storage.rdbms.DatabaseManager.create(DatabaseManager.java:490) at org.dspace.browse.BrowseCreateDAOPostgres.updateCommunityMappings(BrowseCreateDAOPostgres.java:651) ... 8 more Please help me to solve this issue ? Kind Regards and manythanks Hafeez Qazi

    Sakai JIRA | 6 years ago | Hafeez Qazi
    org.dspace.browse.BrowseException: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey"
  6. 0

    Hello , this is my first post for DSPACE . I am trying to Moving items ( 5000) from diffent collections under diffent communites to under one community and diffent collections ?? what is the best method to do this ? i treid these two SQL scripts but now getting error for reindex update item set owning_collection=NewCollectionID where item_id=ItemID; update collection2item set collection_id=new collection it where collection_id= old collection; once it run these two scripts i can see total number of items by title under new collections but can't see them under new community . i tried to update this table communities2item , then its showing total number of items under community as well as differnt collections but when i am trying to reindexing getting this error message ./dspace index-update Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey" org.dspace.browse.BrowseException: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey" at org.dspace.browse.BrowseCreateDAOPostgres.updateCommunityMappings(BrowseCreateDAOPostgres.java:661) at org.dspace.browse.IndexBrowse.indexItem(IndexBrowse.java:402) at org.dspace.browse.IndexBrowse.createIndex(IndexBrowse.java:1148) at org.dspace.browse.IndexBrowse.main(IndexBrowse.java:703) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:212) Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey" at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.dspace.storage.rdbms.DatabaseManager.execute(DatabaseManager.java:1429) at org.dspace.storage.rdbms.DatabaseManager.insert(DatabaseManager.java:736) at org.dspace.storage.rdbms.DatabaseManager.create(DatabaseManager.java:490) at org.dspace.browse.BrowseCreateDAOPostgres.updateCommunityMappings(BrowseCreateDAOPostgres.java:651) ... 8 more Please help me to solve this issue ? Kind Regards and manythanks Hafeez Qazi

    Sakai JIRA | 6 years ago | Hafeez Qazi
    org.dspace.browse.BrowseException: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "communities2item_pkey"
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: insert or update on table "epersongroup2workspaceitem" violates foreign key constraint "epersongroup2workspaceitem_workspace_item_id_fkey" Detail: Key (workspace_item_id)=(-1) is not present in table "workspaceitem".

    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse()
  2. PostgreSQL JDBC Driver
    AbstractJdbc2Statement.executeUpdate
    1. org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531)
    2. org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313)
    3. org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
    4. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
    5. org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
    6. org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308)
    6 frames
  3. Commons DBCP
    DelegatingPreparedStatement.executeUpdate
    1. org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
    2. org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
    2 frames
  4. DSpace Kernel :: API and Implementation
    Supervisor.add
    1. org.dspace.storage.rdbms.DatabaseManager.execute(DatabaseManager.java:1429)
    2. org.dspace.storage.rdbms.DatabaseManager.update(DatabaseManager.java:781)
    3. org.dspace.eperson.Supervisor.add(Supervisor.java:191)
    3 frames
  5. org.dspace.app
    DSpaceServlet.doPost
    1. org.dspace.app.webui.servlet.admin.SuperviseServlet.addSupervisionOrder(SuperviseServlet.java:242)
    2. org.dspace.app.webui.servlet.admin.SuperviseServlet.doDSPost(SuperviseServlet.java:111)
    3. org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:147)
    4. org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:105)
    4 frames
  6. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    2. javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    2 frames
  7. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    2 frames
  8. org.dspace.app
    AdminOnlyFilter.doFilter
    1. org.dspace.app.webui.filter.AdminOnlyFilter.doFilter(AdminOnlyFilter.java:103)
    1 frame
  9. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    2 frames
  10. DSpace Services Framework :: API and Implementation
    DSpaceWebappServletFilter.doFilter
    1. org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:112)
    1 frame
  11. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    8 frames
  12. org.apache.coyote
    AjpAprProtocol$AjpConnectionHandler.process
    1. org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:429)
    2. org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384)
    2 frames
  13. Grizzly HTTP
    AprEndpoint$Worker.run
    1. org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
    1 frame
  14. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:679)
    1 frame