Re: generating a parent/child relationship in a trigger

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: Mark Harrison <mh(at)pixar(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: generating a parent/child relationship in a trigger
Date: 2005-04-15 05:56:32
Message-ID: 418bf6e2ebea1a6069c86a6c2927d222@sitening.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

As long as your input is well-defined, you could certainly do something
like this in a trigger.

Instinctively, I would think that plperl might be a little more wieldy
than plpgsql for the required parsing, but I'm pretty sure a plpgsql
solution could be created. Don't have one handy, though...

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC

Strategic Open Source: Open Your i™

http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

On Apr 12, 2005, at 12:51 PM, Mark Harrison wrote:

> Suppose I'm adding row to a table, and one of the columns is
> a pathname.
>
> I would like to generate in a separate table parent/child
> relationships based on the path.
>
> For example, adding "/foo/bar/baz" and "/foo/bar/bot" would
> generate the following relationships
>
> parent child
> ------ -----
> /foo /foo/bar
> /foo/bar /foo/bar/baz
> /foo/bar /foo/bar/bot
>
> Is this a reasonable thing to do in a trigger? Does anybody
> have a pl/sql snippet to do this?
>
> Many TIA,
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Hallgren 2005-04-15 09:03:19 Re: PostgreSQL 8.0.2 Now Available
Previous Message Jim C. Nasby 2005-04-15 05:06:31 Re: UNION messing up sorting WAS: psql performance