recursive views

Started by Michael Meskesover 27 years ago3 messages
#1Michael Meskes
meskes@topsystem.de

I had some time during vacation to thing about postgresql. And here's the
feature I'd really like to see. This one would put us miles in front of all
others: recursive view definitions.

Just one short example:

There is that well-known parent relation: par (parent, child). The view anc
now should list all ancestors:

create view anc as
select parent as ancestor, child as person from par
union
select anc.ancestor as ancestor, par.child as person
from anc, par
where anc.person = par.parent;

What do you guys think of this idea? How much work would it be to implement
it?

Michael
--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Michael Meskes (#1)
Re: [HACKERS] recursive views

I had some time during vacation to thing about postgresql. And here's the
feature I'd really like to see. This one would put us miles in front of all
others: recursive view definitions.

Just one short example:

There is that well-known parent relation: par (parent, child). The view anc
now should list all ancestors:

create view anc as
select parent as ancestor, child as person from par
union
select anc.ancestor as ancestor, par.child as person
from anc, par
where anc.person = par.parent;

What do you guys think of this idea? How much work would it be to implement
it?

You want views of UNION's. That is not hard to do.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#3Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Michael Meskes (#1)
Re: [HACKERS] recursive views

I had some time during vacation to thing about postgresql. And here's the
feature I'd really like to see. This one would put us miles in front of all
others: recursive view definitions.

Just one short example:

There is that well-known parent relation: par (parent, child). The view anc
now should list all ancestors:

create view anc as
select parent as ancestor, child as person from par
union
select anc.ancestor as ancestor, par.child as person
from anc, par
where anc.person = par.parent;

What do you guys think of this idea? How much work would it be to implement
it?

Ah, you want views of UNION's, and want to specify the view in the
query. Yikes, no idea on how hard that would be.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)