Re: plpgsql handling a set of values - Mailing list pgsql-general

From Alban Hertroys
Subject Re: plpgsql handling a set of values
Date
Msg-id 452B513C.4020401@magproductions.nl
Whole thread Raw
In response to plpgsql handling a set of values  ("pobox@verysmall.org" <pobox@verysmall.org>)
Responses Re: plpgsql handling a set of values  ("pobox@verysmall.org" <pobox@verysmall.org>)
List pgsql-general
pobox@verysmall.org 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@magproductions.nl

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 //

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Intentionally produce Errors
Next
From: Ron Johnson
Date:
Subject: Re: Newbie question about importing text files...