Update from 11306 to 11307 failed. ERROR: duplicate key value violates unique constraint "dynamictables_uk1

Update from 11306 to 11307 failed. ERROR: duplicate key value violates unique constraint "dynamictables_uk1

Updating from 11306 to anything higher results in the following error.

ERROR: duplicate key value violates unique constraint "dynamictables_uk1

Portion of the updatemgrlog0 log file:

Mar 7, 2023 9:25:01 PM  [com.adventnet.servicedesk.updatemgr.util.SDPostProcessor]  [INFO] : Problem during installation of patch {0}com.adventnet.persistence.DataAccessException: [DynamicTables] Batch entry 0 INSERT INTO DynamicTables (DYNAMIC_TABLE_ID,TABLENAME,MODULE,CHAR_COLS,NUM_COLS,DATE_COLS,DEC_COLS,HELPDESKID) VALUES (3301,'ServiceReq_301','ServiceCatalog',0,0,0,0,1) was aborted: ERROR: duplicate key value violates unique constraint "dynamictables_uk1"
  Detail: Key (tablename, helpdeskid)=(ServiceReq_301, 1) already exists.  Call getNextException to see other errors in the batch.
at com.adventnet.persistence.DataAccess.createDataAccessException(DataAccess.java:3077)
at com.adventnet.persistence.DataAccess.insertRows(DataAccess.java:2660)
at com.adventnet.persistence.DataAccess.add(DataAccess.java:342)
at com.adventnet.persistence.DataAccess.add(DataAccess.java:285)
at com.adventnet.persistence.interceptor.CorePersistenceInterceptor.process(CorePersistenceInterceptor.java:53)
at com.manageengine.mdh.QueryInterceptor.process(QueryInterceptor.java:517)
at com.adventnet.authorization.interceptor.AuthorizationInterceptor.process(AuthorizationInterceptor.java:68)
at com.adventnet.persistence.PersistenceBean.process(PersistenceBean.java:620)
at com.adventnet.persistence.PersistenceBean.add(PersistenceBean.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.adventnet.mfw.bean.BeanProxy.invoke(BeanProxy.java:53)
at com.sun.proxy.$Proxy6.add(Unknown Source)
at com.adventnet.servicedesk.utils.DataAccessUtil.add(DataAccessUtil.java:49)
at com.adventnet.servicedesk.updatemgr.util.SDPostProcessorUtil.createTable(SDPostProcessorUtil.java:12678)
at com.adventnet.servicedesk.updatemgr.util.SDPostProcessorUtil.createTableForService(SDPostProcessorUtil.java:12624)
at com.adventnet.servicedesk.updatemgr.util.SDPostProcessorUtil.checkServiceTables(SDPostProcessorUtil.java:12607)
at com.adventnet.servicedesk.updatemgr.util.SDPostProcessor.postInvokeMethods(SDPostProcessor.java:329)
at com.adventnet.servicedesk.updatemgr.util.SDPostProcessor.postInstallPatch(SDPostProcessor.java:137)
at com.adventnet.servicedesk.updatemgr.util.SDPostProcessor.installPatch(SDPostProcessor.java:76)
at com.adventnet.persistence.DefaultPostProcessor.install(DefaultPostProcessor.java:1424)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.adventnet.tools.update.installer.Unzipper.contextPostInstallation(Unzipper.java:1698)
at com.adventnet.tools.update.installer.Unzipper.invokePostInstallationClasses(Unzipper.java:1494)
at com.adventnet.tools.update.installer.ApplyPatch.installPatch(ApplyPatch.java:415)
at com.adventnet.tools.update.installer.ApplyPatch.run(ApplyPatch.java:266)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO DynamicTables (DYNAMIC_TABLE_ID,TABLENAME,MODULE,CHAR_COLS,NUM_COLS,DATE_COLS,DEC_COLS,HELPDESKID) VALUES (3301,'ServiceReq_301','ServiceCatalog',0,0,0,0,1) was aborted: ERROR: duplicate key value violates unique constraint "dynamictables_uk1"
  Detail: Key (tablename, helpdeskid)=(ServiceReq_301, 1) already exists.  Call getNextException to see other errors in the batch.
at com.adventnet.db.adapter.postgres.PostgresDBAdapter.maskMessage(PostgresDBAdapter.java:1832)
at com.adventnet.db.adapter.postgres.PostgresDBAdapter.handleSQLException(PostgresDBAdapter.java:1818)
at com.adventnet.db.adapter.Jdbc20DBAdapter.executeBatch(Jdbc20DBAdapter.java:2592)
at com.adventnet.db.api.RelationalAPI.executeBatch(RelationalAPI.java:851)
at com.adventnet.persistence.DataAccess.insertRows(DataAccess.java:2618)
... 30 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO DynamicTables (DYNAMIC_TABLE_ID,TABLENAME,MODULE,CHAR_COLS,NUM_COLS,DATE_COLS,DEC_COLS,HELPDESKID) VALUES (3301,'ServiceReq_301','ServiceCatalog',0,0,0,0,1) was aborted: ERROR: duplicate key value violates unique constraint "dynamictables_uk1"
  Detail: Key (tablename, helpdeskid)=(ServiceReq_301, 1) already exists.  Call getNextException to see other errors in the batch.
... 35 more
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "dynamictables_uk1"
  Detail: Key (tablename, helpdeskid)=(ServiceReq_301, 1) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:521)
at org.postgresql.jdbc.PgStatement.internalExecuteBatch(PgStatement.java:870)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:893)
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1639)
at com.zoho.cp.WrappedPreparedStatement.executeBatch(WrappedPreparedStatement.java:185)
at com.adventnet.db.adapter.Jdbc20DBAdapter.executeBatch(Jdbc20DBAdapter.java:2588)
... 32 more

Update fails at 74% :



With a generic error:



Reviewing the log files shows the above "duplicate key value violates unique constraint "dynamictables_uk1"" error.

I need help with how to delete the duplicate record in the PostgresSQL DB so that I can perform the update.

                  New to ADSelfService Plus?