Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-596

Cannot Delete Community which has two or more levels of SubCommunities


    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.7.0
    • Component/s: DSpace API
    • Labels:
    • Environment:
    • Attachments:
    • Comments:
    • Documentation Status:
      Not Required


      If you have a Community which has two or more levels of subcommunities, a database error will be thrown when you attempt to delete it.

      As an example, suppose you have the following hierarchy:

      Community 1

      • Sub-Community 1.1
      • Sub-Sub-Community 1.1.1

      In that example, if you attempt to delete "Community 1", then you will end up receiving a "PSQLException" similar to the following:

      org.postgresql.util.PSQLException: ERROR: update or delete on table "community" violates foreign key constraint "com2com_child_fk" on table "community2community"
      Detail: Key (community_id)=(SOME_ID) is still referenced from table "community2community".

      (Where "SOME_ID" will be the internal ID of the "Sub-Community 1.1)

      Essentially, it looks like the Sub-Community 1.1 is unable to be deleted as its ID is not removed from community2community.

      You can see this error by logging in as an Admin and trying to delete the following Top-Level Community on the Demo Server (it has both a sub-community & a sub-sub-community):

      However, it's worth noting that Community deletion works fine if you only have "Sub-Communities" and do not have an "Sub-Sub-Communities".

      I haven't had a chance to figure out why this happens – just wanted to note that it is happening.

      Here's a slightly larger Java stacktrace:

      org.postgresql.util.PSQLException: ERROR: update or delete on table "community" violates foreign key constraint "com2com_child_fk" on table "community2community"
      Detail: Key (community_id)=(42) is still referenced from table "community2community".
      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.updateQuery(DatabaseManager.java:460)
      at org.dspace.storage.rdbms.DatabaseManager.deleteByValue(DatabaseManager.java:605)
      at org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:572)
      at org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:807)
      at org.dspace.content.Community.rawDelete(Community.java:1053)
      at org.dspace.content.Community.removeSubcommunity(Community.java:954)
      at org.dspace.content.Community.rawDelete(Community.java:1030)
      at org.dspace.content.Community.delete(Community.java:1001)
      at org.dspace.app.xmlui.aspect.administrative.FlowContainerUtils.processDeleteCommunity(FlowContainerUtils.java:922)
      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)




            • Assignee:
              cjuergen Claudia Jürgen
              tdonohue Tim Donohue
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: