After uninstalling an application, application tables that were flattened tables leave behind records in sys_storage_alias and physical columns in the database.
Steps to Reproduce
Create a scoped app (app1) with two tables one standalone (table1) and the other extending task (table2), both with full application access from all other scopes.
Create another scoped app (app2) with two fields, one on table1 and the other on table2.
Export both application packages using the Download Package context menu on the Custom Application form.
Navigate to System Applications > Install Application and install the applications (first app1, then app2) on a target instance where they did not exist before.
Make sure all expected sys_storage_alias records are created. Two of them should be for fields in app2 on tables in app1. Focus on these.
Create a record to confirm the tables works as expected.
Uninstall the application app2, and do not retain data.
Note that the sys_storage_alias records identified in step 5 remained behind.
Uninstall the application app1, and do not retain data.
Note that the one of the sys_storage_alias records identified in step 5, relevant to table2, which is extended, still remained behind, while the other records from both apps have been removed
Delete the sys_storage_alias records related to the Scoped Application tables that were dropped while uninstalling the application (this is best done directly on the database). After deleting these sys_storage_alias records, run the following in Scripts - Background to invalidate all related TableDescriptor caches:
Related Problem: PRB644830