Efficiently find common ancestor in postgresql directed acyclic graph
Given a directed acyclic graph shaped like this: "Branch A" "Branch B" branch-a-head-id branch-b-head-id --- | | ^ id-Z id-C | | | | id-Y id-B | | | "Branch A" id-X id-A and | | "Branch B" branch-a-first-id branch-b-first-id…