Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting a host can throw an error #4800

Closed
wezell opened this issue Jan 29, 2014 · 3 comments
Closed

Deleting a host can throw an error #4800

wezell opened this issue Jan 29, 2014 · 3 comments

Comments

@wezell
Copy link
Contributor

wezell commented Jan 29, 2014

Trying to delete this host:

http://screencast.com/t/JwdSZxZUA

 size:1000, toDisk:false,Concurrency:32
[29/01/14 12:57:12:977 EST] ERROR business.HostAPIImpl: ERROR: update or delete on table "identifier" violates foreign key constraint "fk_link_ver_info_ident" on table "link_version_info"
  Detail: Key (id)=(dea2ec46-00fd-4eca-b090-7e371cffa615) is still referenced from table "link_version_info".
com.dotmarketing.exception.DotDataException: ERROR: update or delete on table "identifier" violates foreign key constraint "fk_link_ver_info_ident" on table "link_version_info"
  Detail: Key (id)=(dea2ec46-00fd-4eca-b090-7e371cffa615) is still referenced from table "link_version_info".
    at com.dotmarketing.common.db.DotConnect.loadResult(DotConnect.java:234)
    at com.dotmarketing.portlets.contentlet.business.HostAPIImpl$1DeleteHostThread.deleteHost(HostAPIImpl.java:518)
    at com.dotmarketing.portlets.contentlet.business.HostAPIImpl$1DeleteHostThread.run(HostAPIImpl.java:497)
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "identifier" violates foreign key constraint "fk_link_ver_info_ident" on table "link_version_info"
  Detail: Key (id)=(dea2ec46-00fd-4eca-b090-7e371cffa615) is still referenced from table "link_version_info".
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:381)
    at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
    at com.dotmarketing.common.db.DotConnect.executeQuery(DotConnect.java:564)
    at com.dotmarketing.common.db.DotConnect.executeQuery(DotConnect.java:486)
    at com.dotmarketing.common.db.DotConnect.loadResult(DotConnect.java:232)
    ... 2 more



@ghost ghost assigned dsilvam Jan 29, 2014
dsilvam added a commit that referenced this issue Jan 30, 2014
dsilvam added a commit that referenced this issue Jan 30, 2014
@dsilvam
Copy link
Contributor

dsilvam commented Jan 30, 2014

there are two cases here:

  1. link asset with identifier.asset_type = 'file_asset' (the opposite of the other case we had before)
  2. a container that is referenced from a template that lives in a different host (template_container complains)

the commits here fixes 1). You need to manually remove number 2. We will improve messaging for this, see #4805

@bryanboza
Copy link
Member

Tested on master // H2 and works fine... Just to make, need test in other DB

@bryanboza
Copy link
Member

Fixed, tested on master // MySQL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants