pobox@xxxxxxxxxxxxx wrote:
I am writing a plpgsql (PostgreSQL 8.x) trigger function that should do something on a number of records. The records are in a very simple table with two columns - 'parent_id' and 'child_id'. A 'child' can be as well a 'parent' to one or more children - in this case its ID appears as many times in the 'parent_id' column as many children it has. The input the plpgsql function gets is the ID of the top 'parent'. Then it should find all children and do something with them.
I think you should have a look at the ltree contrib package. It implements tree-like structures, and probably makes your problem much simpler.
-- Alban Hertroys alban@xxxxxxxxxxxxxxxxx magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500 AK Enschede // Integrate Your World //