rg.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue".

Sakai JIRA | Ivan Masár | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    DS-12 fixed this problem long time ago in JSPUI. But in XMLUI after deleting a metadata field that still has values present this error page shows up: org.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue". Here's the Java stacktrace: rg.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.dspace.storage.rdbms.DatabaseManager.updateQuery(DatabaseManager.java:421) at org.dspace.storage.rdbms.DatabaseManager.deleteByValue(DatabaseManager.java:572) at org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:536) at org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:760) at org.dspace.content.MetadataField.delete(MetadataField.java:485) at org.dspace.app.xmlui.aspect.administrative.FlowRegistryUtils.processDeleteMetadataField(FlowRegistryUtils.java:398)

    Sakai JIRA | 4 years ago | Ivan Masár
    rg.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue".
  2. 0

    DS-12 fixed this problem long time ago in JSPUI. But in XMLUI after deleting a metadata field that still has values present this error page shows up: org.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue". Here's the Java stacktrace: rg.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.dspace.storage.rdbms.DatabaseManager.updateQuery(DatabaseManager.java:421) at org.dspace.storage.rdbms.DatabaseManager.deleteByValue(DatabaseManager.java:572) at org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:536) at org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:760) at org.dspace.content.MetadataField.delete(MetadataField.java:485) at org.dspace.app.xmlui.aspect.administrative.FlowRegistryUtils.processDeleteMetadataField(FlowRegistryUtils.java:398)

    Sakai JIRA | 4 years ago | Ivan Masár
    rg.postgresql.util.PSQLException: ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue".

    Root Cause Analysis

    1. rg.postgresql.util.PSQLException

      ERROR: update or delete on table "metadatafieldregistry" violates foreign key constraint "metadatavalue_metadata_field_id_fkey" on table "metadatavalue" Detail: Key (metadata_field_id)=(90) is still referenced from table "metadatavalue".

      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse()
    2. PostgreSQL JDBC Driver
      AbstractJdbc2Statement.executeUpdate
      1. org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
      2. org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
      3. org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
      4. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
      5. org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
      6. org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
      6 frames
    3. Commons DBCP
      DelegatingPreparedStatement.executeUpdate
      1. org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      2. org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      3. org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      3 frames
    4. DSpace Kernel :: API and Implementation
      MetadataField.delete
      1. org.dspace.storage.rdbms.DatabaseManager.updateQuery(DatabaseManager.java:421)
      2. org.dspace.storage.rdbms.DatabaseManager.deleteByValue(DatabaseManager.java:572)
      3. org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:536)
      4. org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:760)
      5. org.dspace.content.MetadataField.delete(MetadataField.java:485)
      5 frames
    5. org.dspace.app
      FlowRegistryUtils.processDeleteMetadataField
      1. org.dspace.app.xmlui.aspect.administrative.FlowRegistryUtils.processDeleteMetadataField(FlowRegistryUtils.java:398)
      1 frame