pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <jim@nasby.net>
To: Jay A. Kreibich <jak@uiuc.edu>
Cc: Alexander Burbello <burbello3000@yahoo.com.br>
Cc: Lista Postgres <pgsql-admin@postgresql.org>
Subject: Re: Recursive use
Date: Tue, 10 Oct 2006 10:15:42 -0500
Message-ID: <20061010151541.GF72517@nasby.net> (raw)
In-Reply-To: <20061006153726.GB15913@uiuc.edu>
References: <4523B23A.3000506@yahoo.com.br>
	<20061006153726.GB15913@uiuc.edu>

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.
<snip>
>   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
Smarties.

There's also the ltree module in contrib that might be of some use.
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)



view thread (9+ messages)  latest in thread

Message-ID: <20061010151541.GF72517@nasby.net>
Permalink:  ../20061010151541.GF72517@nasby.net/
Also on:    postgresql.org/message-id/20061010151541.GF72517@nasby.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jim@nasby.net, jak@uiuc.edu, burbello3000@yahoo.com.br
  Subject: Re: Recursive use
  In-Reply-To: <20061010151541.GF72517@nasby.net>
  References: <4523B23A.3000506@yahoo.com.br> <20061006153726.GB15913@uiuc.edu> <20061010151541.GF72517@nasby.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox