org.postgresql.util.PSQLException: ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates".

Atlassian JIRA | Partha Kamal [Atlassian] | 7 years ago
  1. 0

    h4. Steps to reproduce: 1) Create a test space 2) Go to Advanced > Templates and create 3 templates (it must be 3 templates) 3) After creating 3 templates, edit each of those templates so they have multiple versions in the database 4) Try and remove the space You will get an error similar to: {noformat} Cause org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.confluence.pages.templates.PageTemplate#8782084]; SQL []; ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates". at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:110) caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) Stack Trace:[hide] org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.confluence.pages.templates.PageTemplate#8782084]; SQL []; ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates". Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:321) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.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:2449) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2397) at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1821) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1578) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49) at org.springframework.orm.hibernate.HibernateTemplate$20.doInHibernate(HibernateTemplate.java:731) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370) at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:717) at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:700) at bucket.search.persistence.dao.hibernate.HibernateIndexQueueEntryDao.getNewEntries(HibernateIndexQueueEntryDao.java:49) at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy15.getNewEntries(Unknown Source) at com.atlassian.confluence.search.lucene.queue.DatabaseIndexTaskQueue.getUnflushedEntries(DatabaseIndexTaskQueue.java:163) at com.atlassian.confluence.search.lucene.queue.DatabaseIndexTaskQueue.flushQueue(DatabaseIndexTaskQueue.java:146) at com.atlassian.confluence.search.lucene.DefaultConfluenceIndexManager.flushQueue(DefaultConfluenceIndexManager.java:94) at sun.reflect.GeneratedMethodAccessor310.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy36.flushQueue(Unknown Source) at com.atlassian.confluence.spaces.DefaultSpaceManager.removeSpace(DefaultSpaceManager.java:172) 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) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy41.removeSpace(Unknown Source) {noformat} h4. Workaround Go to the Space > Browse > Advanced and click on templates. Remove all the templates from the space then remove the space.

    Atlassian JIRA | 7 years ago | Partha Kamal [Atlassian]
    org.postgresql.util.PSQLException: ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates".
  2. 0

    Talk:Osmosis - OpenStreetMap Wiki

    openstreetmap.org | 5 months ago
    org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to create resultset.
  3. 0

    Error while following osmosis import to database examples - OSM Help

    openstreetmap.org | 1 year ago
    org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to create resultset.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring batch insert/update to postgres using prepared statement

    Stack Overflow | 6 months ago | Prabodh Hend
    org.postgresql.util.PSQLException: ERROR: duplicate key violates unique constraint "table1_pkey" (seg576 sdw24:40000 pid=398877)
  6. 0

    Improve code generator compatibility with PostgreSQL 8.x by avoiding the use of window functions

    GitHub | 3 years ago | lukaseder
    org.postgresql.util.PSQLException: ERROR: syntax error at or near "over" Position: 92

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.postgresql.util.PSQLException

      ERROR: update or delete on table "pagetemplates" violates foreign key constraint "fkbc7ce96a17d4a070" on table "pagetemplates" Detail: Key (templateid)=(8782084) is still referenced from table "pagetemplates".

      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse()
    2. PostgreSQL JDBC Driver
      QueryExecutorImpl.receiveErrorResponse
      1. org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
      1 frame