ORA-02292: integrity constraint (CONFLUENCEADM_ADM.FK9DC3E34D34A4917E) violated - child record found
Asked by Michael Regelin:

I recently tried to delete a whole space.

I received always an 500 error.

Thus, i dig and found that some pages from the trash of this space could not been deleted.

Every time i get this error:

```
2012-09-20 14:34:48,698 ERROR [TP-Processor54] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action -- referer: https://prod.etat-ge.ch/wikiadm/pages/purgetrashitem.action?key=TESTORGA1&amp;contentId=351699500 | url: /wikiadm/pages/dopurgetrashitem.action | userName: regelinorg.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.confluence.pages.Attachment#351864690]; SQL []; ORA-02292: integrity constraint (CONFLUENCEADM_ADM.FK9DC3E34D34A4917E) violated - child record found; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (CONFLUENCEADM_ADM.FK9DC3E34D34A4917E) violated - child record foundCaused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (CONFLUENCEADM_ADM.FK9DC3E34D34A4917E) violated - child record found        at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:765)        at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:662)        at oracle.jdbc.driver.T2CPreparedStatement.executeForDescribe(T2CPreparedStatement.java:546)        at oracle.jdbc.driver.T2CPreparedStatement.executeForRows(T2CPreparedStatement.java:729)        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3665)        at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1352)        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)        at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)        at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:581)        at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)        at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2447)        at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2433)        at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2395)        at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)        at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)        at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:510)        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)        at com.atlassian.xwork.interceptors.TransactionalInvocation.commitOrRollbackTransaction(TransactionalInvocation.java:107)        at com.atlassian.xwork.interceptors.TransactionalInvocation.access$000(TransactionalInvocation.java:18)        at com.atlassian.xwork.interceptors.TransactionalInvocation$1.beforeResult(TransactionalInvocation.java:49)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:181)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(DefaultWorkflowInterceptor.java:55)        at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.xwork.interceptors.XsrfTokenInterceptor.intercept(XsrfTokenInterceptor.java:100)        at com.atlassian.confluence.xwork.ConfluenceXsrfTokenInterceptor.intercept(ConfluenceXsrfTokenInterceptor.java:25)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.security.interceptors.CaptchaInterceptor.intercept(CaptchaInterceptor.java:46)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.util.LoggingContextInterceptor.intercept(LoggingContextInterceptor.java:49)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.core.CancellingInterceptor.intercept(CancellingInterceptor.java:23)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.security.websudo.WebSudoInterceptor.intercept(WebSudoInterceptor.java:31)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.security.actions.PermissionCheckInterceptor.intercept(PermissionCheckInterceptor.java:57)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.setup.webwork.BootstrapAwareInterceptor.intercept(BootstrapAwareInterceptor.java:26)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.user.actions.UserAwareInterceptor.intercept(UserAwareInterceptor.java:58)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.pages.actions.CommentAwareInterceptor.intercept(CommentAwareInterceptor.java:43)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.pages.actions.PageAwareInterceptor.intercept(PageAwareInterceptor.java:106)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.spaces.actions.SpaceAwareInterceptor.intercept(SpaceAwareInterceptor.java:68)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.core.actions.LastModifiedInterceptor.intercept(LastModifiedInterceptor.java:38)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.core.ConfluenceAutowireInterceptor.intercept(ConfluenceAutowireInterceptor.java:38)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.xwork.interceptors.TransactionalInvocation.invokeAndHandleExceptions(TransactionalInvocation.java:76)        at com.atlassian.xwork.interceptors.TransactionalInvocation.invokeInTransaction(TransactionalInvocation.java:61)        at com.atlassian.xwork.interceptors.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:56)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.atlassian.confluence.xwork.SetupIncompleteInterceptor.intercept(SetupIncompleteInterceptor.java:40)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)        at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:115)        at com.atlassian.confluence.servlet.ConfluenceServletDispatcher.serviceAction(ConfluenceServletDispatcher.java:53)        at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:199)        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 com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)        at com.arsenale.plugins.lockpoint.LifecycleFilter.doFilter(SourceFile:53)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.security.websudo.MessagesDecoratorFilter.doFilter(MessagesDecoratorFilter.java:49)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)        at com.atlassian.confluence.util.profiling.ProfilingPageFilter.parsePage(ProfilingPageFilter.java:84)        at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:54)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.jmx.JmxFilter.doFilter(JmxFilter.java:106)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.core.filters.ServletContextThreadLocalFilter.doFilter(ServletContextThreadLocalFilter.java:19)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.util.LoggingContextFilter.doFilter(LoggingContextFilter.java:40)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.web.filter.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:22)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.util.UserThreadLocalFilter.doFilter(UserThreadLocalFilter.java:44)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:211)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98)        at com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:30)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:150)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)        at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:71)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:34)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:72)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)        at com.atlassian.spring.filter.FlushingSpringSessionInViewFilter.doFilterInternal(FlushingSpringSessionInViewFilter.java:29)        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.util.ConfluenceErrorFilter.doFilter(ConfluenceErrorFilter.java:22)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:99)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.core.datetime.RequestTimeThreadLocalFilter.doFilter(RequestTimeThreadLocalFilter.java:35)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:80)        at com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:51)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.core.filters.cache.AbstractCachingFilter.doFilter(AbstractCachingFilter.java:33)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)        at com.atlassian.confluence.extra.webdav.servlet.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:43)        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter.doFilter(RequestParamValidationFilter.java:58)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.plugin.servlet.filter.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:71)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:52)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:25)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:65)        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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:589)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)        at java.lang.Thread.run(Thread.java:662)
```

```

```

Does someone knows how to get rid of these and continue in deleting the pages and the space ?

We use confluence 3.5.13 and have oracle database.


Answers:
author: Adam Laskowski
body: The constraint that the error is referencing is this foreign key:

```
Foreign-key constraints:    "fk9dc3e34d34a4917e" FOREIGN KEY (attachmentid) REFERENCES attachments(attachmentid)
```

Since you're deleting the space anyhow, you can just remove all of the ATTACHMENTDATA rows that correspond to pages in the space you're deleting, which should allow the rows in the ATTACHMENT table to be removed. I **highly**recommend replicating your instance in a test environment to test this query, and prior to running it in production, take a DB backup:

```
delete from attachmentdata where attachmentid in (select a.attachmentid from attachments a join content c on a.pageid=c.contentid join spaces s on c.spaceid=s.spaceid where s.spacekey='TESTORGA1');
```

comments: author: Michael Regelin
body: Hi Adam,

thanks sor your reply and sorry for my late response.

I will test tommorow.

I really appreciate. thanks.

Michael


author: Sam Hall
body: I've noticed this problem is caused by some pages in the wiki containing two attachments with the same title in our 5.7.5 Confluence instance. I'm trying to clean up the situation in preparation for exporting attachments from the database to the filesystem.

I'm suspecting the cause was the user double tapping the upload button or something like that. Also some of the impacted pages appear to have been created by importing a word document that contained attachments, and the user seems to have repeated the process a second time. Probably should have been a unique constraint on title, version and pageid.

Here is the Oracle query I developed to determine the extent of the issue...

```
SELECT  C.PAGEID, count('v'||VERSION || ':' || TITLE) - count(distinct 'v'||VERSION || ':' || TITLE) dupesFROM CONTENT CWHERE C.CONTENTTYPE = 'ATTACHMENT'GROUP BY C.PAGEIDORDER BY DUPES DESC;
```

comments: author: Sam Hall
body: I found that once the culprit attachment title and pageid are identified, you can delete one copy of the attachment through Confluence by tracking down the page (and restoring if required) via /pages/viewpage.action?pageId=XXXXXXX then the issue should be fixed without any database hacks.