[Dspace-tech] Delete item/collection/communities

138 views
Skip to first unread message

Gustavo

unread,
Aug 26, 2015, 11:38:10 AM8/26/15
to dspac...@lists.sourceforge.net
I have update to Dspace 3.1 and when I try to delete an item, collection o
communitie, it show the message:
Excepción:
org.postgresql.util.PSQLException: ERROR: update o delete en «item» viola la
llave foránea «communities2item_item_id_fkey» en la tabla «communities2item»
Detail: La llave (item_id)=(1984) todavía es referida desde la tabla
«communities2item».
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorI
mpl.java:2103)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.ja
va:1836)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:512)

*****************************
Gustavo Perosillo Herrera
STIC- Universidad de Valladolid
Telefono: 983423418
e-mail: gustavo....@uva.es
*********************************




helix84

unread,
Aug 26, 2015, 11:38:11 AM8/26/15
to Gustavo, dspac...@lists.sourceforge.net
Hi Gustavo,

the item is probably an unfinished submission. Check your list of
pending submissions. If that doesn't help, you can do

DELETE FROM communities2item WHERE item_id=1984;

and then try again deleting the item.


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> DSpace-tech mailing list
> DSpac...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dspace-tech
> List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Gustavo

unread,
Aug 26, 2015, 11:39:37 AM8/26/15
to hel...@centrum.sk, dspac...@lists.sourceforge.net
DSpace 3.0 allow customize which browse engine is utilized.
I use now SOLR Browse Engine(browseCreateDAO.class = org.dspace.browse.SolrBrowseCreateDAO). This class not add/remove any row in communities2item table. When I add an item no new row are add in the communities2item table.
Above I used browseCreateDAO.class = org.dspace.browse.BrowseCreateDAOPostgres when I add an item, a new row are add in the communities2item table each item.
When I attempt to erase an item add with the old configuration browseCreateDAO.class = org.dspace.browse.BrowseCreateDAOPostgres since the new configuration browseCreateDAO.class = org.dspace.browse.SolrBrowseCreateDAO no row are deleted from communities2item and an error ocurr
Excepción:
> org.postgresql.util.PSQLException: ERROR: update o delete en «item»
> viola la llave foránea «communities2item_item_id_fkey» en la tabla «communities2item»
> Detail: La llave (item_id)=(1984) todavía es referida desde la tabla
> «communities2item».

*****************************
Gustavo Perosillo Herrera
STIC- Universidad de Valladolid
Telefono: 983423418
e-mail: gustavo....@uva.es
*********************************

-----Mensaje original-----
De: ivan....@gmail.com [mailto:ivan....@gmail.com] En nombre de helix84
Enviado el: viernes, 26 de julio de 2013 14:12
Para: Gustavo
CC: dspac...@lists.sourceforge.net
Asunto: Re: [Dspace-tech] Delete item/collection/communities

Andrea Bollini

unread,
Aug 26, 2015, 11:39:39 AM8/26/15
to Gustavo, dspac...@lists.sourceforge.net
Hi Gustavo,
have you run the index-init script as part of you upgrade process *after* to have changed the Browse implementation?
The org.dspace.browse.SolrBrowseCreateDAO
https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/browse/SolrBrowseCreateDAO.java#L404
delegate to the DBMS browse implementation the drop of any old tables/views that could be created before for the browse using the DBMS implementation.
Looking to the code it seems that I have missed to delegate the operation for the deleteCommunityMappings (but not sure that it is really needed)
https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/browse/SolrBrowseCreateDAO.java#L362
that looks as possible source for your issue.
If you switch back to the SOLR implementation you can just delete all the rows in the communities2item table and you should not have any more issues deleting items as the SOLR implementation never write in this table.

I will appreciate too if you can check if delegating the operation for the method deleteCommunityMappings
i.e.
@Override
    public void deleteCommunityMappings(int itemID) throws BrowseException
    {
	dbCreateDAO.deleteCommunityMappings(itemID);
    }

solve your problem running the index-init script.
Please report also this issue as a JIRA bug
Thanks,
Andrea


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

    


-- 
Andrea Bollini
Dipartimento Servizi e Soluzioni per l'Amministrazione Universitaria
Divisione Ricerca

Via dei Tizii, 6
00185 Roma, Italy
tel. +39 06 44 486 087 - mob. +39 348 82 77 525
http://www.cineca.it

helix84

unread,
Aug 26, 2015, 11:39:39 AM8/26/15
to Gustavo, Andrea Bollini, dspac...@lists.sourceforge.net
Hi,

I tried to give generic advice regarding the SQL constraint, but
Andrea (in CC) wrote the SolrBrowseCreateDAO, so he will probably know
the particular implementation details.
Reply all
Reply to author
Forward
0 new messages