Skip site navigation (1) Skip section navigation (2)

Re: Recursive use

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: "Jay A(dot) Kreibich" <jak(at)uiuc(dot)edu>
Cc: Alexander Burbello <burbello3000(at)yahoo(dot)com(dot)br>,Lista Postgres <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Recursive use
Date: 2006-10-10 15:15:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Fri, Oct 06, 2006 at 10:37:26AM -0500, Jay A. Kreibich wrote:
>   These are generally referred to as "Hierarchical Queries" and center
>   around the idea of a self-referencing table (such as an employee
>   table with a "manager" field that is a FK to another row in the same
>   table).  This essentially makes a tree-like structure.
>   As pointed out by others, the most general way to deal with this in
>   PostgreSQL is to write PL/PgSQL (or some other language) functions
>   that can generate the specific queries you need.  It isn't always
>   pretty, but it can be made to work for a specific set of queries.

There are also other ways to represent this type of information without
using hierarchical queries. Joe Celko presents two methods in SQL For

There's also the ltree module in contrib that might be of some use.
Jim Nasby                                            jim(at)nasby(dot)net
EnterpriseDB      512.569.9461 (cell)

In response to


pgsql-admin by date

Next:From: Jim C. NasbyDate: 2006-10-10 15:24:57
Subject: Re: Copying data from table to table (cloned tables)
Previous:From: Jim C. NasbyDate: 2006-10-10 15:11:08
Subject: Re: postgres in HA constellation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group