From: | Chris Browne <cbbrowne(at)acm(dot)org> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Recursive use |
Date: | 2006-10-06 18:04:01 |
Message-ID: | 60sli1fhim.fsf@dba2.int.libertyrms.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
burbello3000(at)yahoo(dot)com(dot)br (Alexander Burbello) writes:
> Hi people,
>
> I need to know if Postgres do recursive search and how can I do!
> I will explain my problem.
>
>
> table COOPERATIVE
> code_cooperative int
> code_coo_father int
>
> I can have 3 level by business rules
>
> 1 - Father
> ----- 2 - Children
> --------- 3 - Grandchildren
>
>
> I would like to have a query asking who is father and granfather
> select grandfather, father from COOPERATIVE where COD_COOPERATIVE = 3
>
> Do the Postgres can solve this problem?
> Could anybody help me?
There was a proposal to implement WITH RECURSIVE for PostgreSQL 8.2;
that fell by the wayside.
The task is on the ToDo list:
<http://www.postgresql.org/docs/faqs.TODO.html>
Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT
At present, you may simulate this by writing a pl/pgsql function that
does the recursion in procedural code.
--
let name="cbbrowne" and tld="linuxdatabases.info" in name ^ "@" ^ tld;;
http://cbbrowne.com/info/postgresql.html
"Nondeterminism means never having to say you're wrong." -- Unknown
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2006-10-06 19:01:34 | Re: Disk space consumed by pk not returned after vacuum or |
Previous Message | Joshua D. Drake | 2006-10-06 16:10:06 | Re: How to install postgreSQL 8.1.4 on RHEL -ES 4 |