Recursive request ...

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

Recursive request ...

От:
Benoît Bournon <benoit.bournon@adelis.com>
Дата:
I have to make a function that returns a tree with title and link of a 
table.

Recursively, a information depends on a parent information.

It is to organise a menu with parent dependance.

How is it possible and faster  ? in C ? pl/pgsql or other ?


Re: Recursive request ...

От:
Joe Conway <mail@joeconway.com>
Дата:
Benoît Bournon wrote:
> I have to make a function that returns a tree with title and link of a 
> table.
> 
> Recursively, a information depends on a parent information.
> 
> It is to organise a menu with parent dependance.
> 
> How is it possible and faster  ? in C ? pl/pgsql or other ?
> 

On 7.3 and later: see contrib/tablefunc. The function is called connectby().

HTH,

Joe


Re: Recursive request ...

От:
Rod Taylor <rbt@rbt.ca>
Дата:
On Wed, 2003-07-09 at 15:27, Benoît Bournon wrote:
> I have to make a function that returns a tree with title and link of a 
> table.
> 
> Recursively, a information depends on a parent information.
> 
> It is to organise a menu with parent dependance.
> 
> How is it possible and faster  ? in C ? pl/pgsql or other ?

If your only concern is speed, go with a C function. This (however) can
make backing up / restoring the database to a different machine a little
bit cumbersome.  You need to be sure to install the modules on the other
box manually prior to restoring the database itself.

Re: Recursive request ...

От:
Rajesh Kumar Mallah <mallah@trade-india.com>
Дата:

Dear Bournon,

There are already good implementation of Tree
structures in databases ranging from using pure SQL
to PostgreSQL specfic methods , less point in 
revinting wheel unless u really need.

Some Pointers:

"Tree-structure functions"
http://www.brasileiro.net:8080/postgres/cookbook/


Gist Based:
contrib/ltree


Joe Celko's Article on "Nested Sets & Adjacency Lists"

http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html
http://users.starpower.net/rjhalljr/Serve/MySQL/traer.html
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=adjacency+list+%2B+tree+%2B+joe



On Wednesday 09 Jul 2003 8:57 pm, Benoît Bournon wrote:
> I have to make a function that returns a tree with title and link of a
> table.
>
> Recursively, a information depends on a parent information.
>
> It is to organise a menu with parent dependance.
>
> How is it possible and faster  ? in C ? pl/pgsql or other ?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


Re: Recursive request ...

От:
BenLaKnet <benlaknet@icqmail.com>
Дата:
 I see connect by in Oracle 


??? is there an equivalent in PostgreSQL or not ??



Rajesh Kumar Mallah a écrit:
Dear Bournon,

There are already good implementation of Tree
structures in databases ranging from using pure SQL
to PostgreSQL specfic methods , less point in 
revinting wheel unless u really need.

Some Pointers:

"Tree-structure functions"
http://www.brasileiro.net:8080/postgres/cookbook/


Gist Based:
contrib/ltree


Joe Celko's Article on "Nested Sets & Adjacency Lists"

http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html
http://users.starpower.net/rjhalljr/Serve/MySQL/traer.html
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=adjacency+list+%2B+tree+%2B+joe



On Wednesday 09 Jul 2003 8:57 pm, Benoît Bournon wrote: 
I have to make a function that returns a tree with title and link of a
table.

Recursively, a information depends on a parent information.

It is to organise a menu with parent dependance.

How is it possible and faster  ? in C ? pl/pgsql or other ?


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster   

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
 

Re: Recursive request ...

От:
Joe Conway <mail@joeconway.com>
Дата:
BenLaKnet wrote:
> I see connect by in Oracle
> 
> ??? is there an equivalent in PostgreSQL or not ??

Someone is working on the SQL99 equivalent, but it isn't done yet. 
Perhaps for 7.5.

Joe


Re: Recursive request ...

От:
Greg Stark <gsstark@mit.edu>
Дата:
Joe Conway  writes:

> BenLaKnet wrote:
> > I see connect by in Oracle
> > ??? is there an equivalent in PostgreSQL or not ??
> 
> Someone is working on the SQL99 equivalent, but it isn't done yet. Perhaps for
> 7.5.

There's a connectby hack in the contrib/tablefunc directory. I haven't used it
so I'm not clear on how powerful it is compared to the real deal, but people
on one of the pgsql lists seemed to find it useful when it came up in the
past.

   connectby(text relname, text keyid_fld, text parent_keyid_fld,               text start_with, int max_depth [, text branch_delim])     - returns keyid, parent_keyid, level, and an optional branch string     - requires anonymous composite type syntax in the FROM clause. See       the instructions in the documentation below.


-- 
greg


Re: Recursive request ...

От:
Benoît Bournon <benoit.bournon@adelis.com>
Дата:
 Thx a lot,  I know now that it is possible to do that with pure sql.



Have you the alogorythm, because your link is dead ?


Ben


Rajesh Kumar Mallah a écrit:
Dear Bournon,

There are already good implementation of Tree
structures in databases ranging from using pure SQL
to PostgreSQL specfic methods , less point in 
revinting wheel unless u really need.

Some Pointers:

"Tree-structure functions"
http://www.brasileiro.net:8080/postgres/cookbook/


Gist Based:
contrib/ltree


Joe Celko's Article on "Nested Sets & Adjacency Lists"

http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html
http://users.starpower.net/rjhalljr/Serve/MySQL/traer.html
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=adjacency+list+%2B+tree+%2B+joe



On Wednesday 09 Jul 2003 8:57 pm, Benoît Bournon wrote: 
I have to make a function that returns a tree with title and link of a
table.

Recursively, a information depends on a parent information.

It is to organise a menu with parent dependance.

How is it possible and faster  ? in C ? pl/pgsql or other ?


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster   

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
 

Re: Recursive request ...

От:
Benoît Bournon <benoit.bournon@adelis.com>
Дата:
 I see connect by in Oracle 


??? it is equivalent in PostgreSQL or not ??


Rajesh Kumar Mallah a écrit:
Dear Bournon,

There are already good implementation of Tree
structures in databases ranging from using pure SQL
to PostgreSQL specfic methods , less point in 
revinting wheel unless u really need.

Some Pointers:

"Tree-structure functions"
http://www.brasileiro.net:8080/postgres/cookbook/


Gist Based:
contrib/ltree


Joe Celko's Article on "Nested Sets & Adjacency Lists"

http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html
http://users.starpower.net/rjhalljr/Serve/MySQL/traer.html
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=adjacency+list+%2B+tree+%2B+joe



On Wednesday 09 Jul 2003 8:57 pm, Benoît Bournon wrote: 
I have to make a function that returns a tree with title and link of a
table.

Recursively, a information depends on a parent information.

It is to organise a menu with parent dependance.

How is it possible and faster  ? in C ? pl/pgsql or other ?


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster   

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
 
FAQ