detach_partition clears cache, but the model partitions still holds partitions that were detached.
Using rails (7.0.3.1), postgresql 14 DB, pg_party (1.9.0). detach_partition clears cache, but the model partitions still holds partitions that were detached.
I don't know your exact situation, but my guess is that you have multiple instances of your Rails app?
From the readme:
Note that caching is done in-memory for each process of an application. Attaching / detaching partitions will clear the cache, but only for the process that initiated the request. For multi-process web servers, it is recommended to use a TTL or disable caching entirely.
It happens in rails test. I guess due to rails test parallelism the caching issues occur. But I tried to disable caching for test environment and still the issue occurred intermittently.