How can I recursively retrieve the top parent ID by querying with any of its (grand)child IDs in PostgreSQL?
I've looked at half a dozen different answers here on various scenarios that require recursive CTEs and experimented with them, but have been unable to adapt any of them to work in this situation. I just fundamentally don't understand how…