Обсуждение: connect by [prior]

Поиск
Список
Период
Сортировка

connect by [prior]

От
"Gerard TOURRES"
Дата:
Hi,

I can't find an equivalent for select...connect by (sort data in a
tree, beginning at a defined point towards 'son' or 'father').

Running Psql 7.2.1 on Debian woody

Any help appreciated

Sorry for my poor english

G�rard TOURRES
----------------------------------------
Computers are like air-conditioners,
They stop working properly
When you open windows
------------------------------------------



Re: connect by [prior]

От
Nabil Sayegh
Дата:
Am Mit, 2003-05-21 um 10.42 schrieb Gerard TOURRES:

> I can't find an equivalent for select...connect by (sort data in a
> tree, beginning at a defined point towards 'son' or 'father').
>
> Running Psql 7.2.1 on Debian woody

This is called "WITH RECURSIVE" in SQL '99 and not yet implemented in
7.3.1
But it is possible to write a "stored procedure" (function) that does
the same thing.


http://216.239.33.100/search?q=cache:bo25WxY-5v0J:not.disenchanted.com/6008.html+select+%22connect+by%22+postgresql&hl=en&ie=UTF-8

cu
--
 e-Trolley Sayegh & John, Nabil Sayegh
 Tel.: 0700 etrolley /// 0700 38765539
 Fax.: +49 69 8299381-8
 PGP : www.e-trolley.de


Re: connect by [prior]

От
Joe Conway
Дата:
Nabil Sayegh wrote:
> Am Mit, 2003-05-21 um 10.42 schrieb Gerard TOURRES:
>>I can't find an equivalent for select...connect by (sort data in a
>>tree, beginning at a defined point towards 'son' or 'father').
>>
>>Running Psql 7.2.1 on Debian woody
>
> This is called "WITH RECURSIVE" in SQL '99 and not yet implemented in
> 7.3.1
> But it is possible to write a "stored procedure" (function) that does
> the same thing.

Gerard's question was WRT 7.2.1, not 7.3.1. I'm afraid on 7.2.x you are
pretty much out of luck :-(

If you do upgrade to 7.3.x (7.3.3 ought to be out by next week), then in
contrib/tablefunc there is a function called connectby() that should do
what you're looking for.

There was some discussion about someone implementing SQL '99 "WITH
RECURSIVE" for 7.4, but it doesn't look like that is going to happen --
maybe for 7.5 it will be there.

HTH,

Joe