# AWX Clean Up job cannot delete \_unpartitioned tables

**URL:** <https://forum.ansible.com/t/awx-clean-up-job-cannot-delete-unpartitioned-tables/44066>\
**Category:** Get Help\
**Tags:** awx, kubernetes\
**Created:** [July 24, 2025, 1:24pm UTC](https://forum.ansible.com/t/awx-clean-up-job-cannot-delete-unpartitioned-tables/44066 "2025-07-24T13:24:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HuubNijs](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@HuubNijs](https://forum.ansible.com/u/HuubNijs)\
**Post date:** [July 24, 2025, 1:24pm UTC](https://forum.ansible.com/t/awx-clean-up-job-cannot-delete-unpartitioned-tables/44066/1 "2025-07-24T13:24:20Z")

</div>

We update AWX

- from version 6 (…) to 24.6.1 by use of fitbeard awx without kubernetes
- We use an external postgres 16 database.
- After restoring the dump to the new version a AWX migration took place, and
- everythings works fine, except for
- the “Cleanup Job”. It says it deletes (thousands) of entries, but then fails on deleting the 5 _unpartioned_\* tables.
- When emptying these tables, a DROP tables fails, but a DROP CASCADE tables succeeds.
- But then jobs will not show any output anymore while or after running.  
We get messages like:

> cannot drop table \_unpartitioned\_main\_adhoccommandevent because other objects depend on it  
> DETAIL: default value for column id of table main\_adhoccommandevent depends on sequence main\_adhoccommandevent\_id\_seq

and

> django.db.utils.IntegrityError: update or delete on table “main\_inventoryupdate” violates foreign key constraint “main\_inventoryupdate\_inventory\_update\_id\_8974f1f7\_fk\_main\_inve” on table “\_unpartitioned\_main\_inventoryupdateevent”  
> DETAIL: Key (unifiedjob\_ptr\_id)=(523855) is still referenced from table “\_unpartitioned\_main\_inventoryupdateevent”.

I understand the \_unpartioned tables are introduced in v19 and are no longer of use anymore?  
Dropping these tables changes the dump from 400Mb to a mere 40Mb, but leaves us with a partial functional AWX.

Is there a way to clean up wisely these \_unpartioned tables?

Cheers, Huub

---

<div class="post-metadata">

**Author:** ![HuubNijs](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@HuubNijs](https://forum.ansible.com/u/HuubNijs)\
**Post date:** [August 27, 2025, 9:30am UTC](https://forum.ansible.com/t/awx-clean-up-job-cannot-delete-unpartitioned-tables/44066/2 "2025-08-27T09:30:22Z")

</div>

We found a way:

- Make a dump of your database, and stop AWX frontend.
- `pg_restore -l awx-db.dump > restore.pgdump.list`
- Remove the 5 lines with \_unpartitioned\* tables form that list
- `pg_restore -v -L restore.pgdump.list -d awx awx-db.dump`
- Start AWX.
- Now everthing works fine.
