pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Recursive request ...
9+ messages / 6 participants
[nested] [flat]

* Recursive request ...
@ 2003-07-09 15:27  Benoît Bournon <benoit.bournon@adelis.com>
  0 siblings, 3 replies; 9+ messages in thread

From: Benoît Bournon @ 2003-07-09 15:27 UTC (permalink / raw)
  To: pgsql-sql

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 ?




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-10 07:44  Joe Conway <mail@joeconway.com>
  parent: Benoît Bournon <benoit.bournon@adelis.com>
  2 siblings, 0 replies; 9+ messages in thread

From: Joe Conway @ 2003-07-10 07:44 UTC (permalink / raw)
  To: Benoît Bournon <benoit.bournon@adelis.com>; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-10 13:32  Rod Taylor <rbt@rbt.ca>
  parent: Benoît Bournon <benoit.bournon@adelis.com>
  2 siblings, 0 replies; 9+ messages in thread

From: Rod Taylor @ 2003-07-10 13:32 UTC (permalink / raw)
  To: Benoît Bournon <benoit.bournon@adelis.com>; +Cc: pgsql-sql

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.

Attachments:

  signature.asc (application/pgp-signature, 186B) download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-13 06:47  Rajesh Kumar Mallah <mallah@trade-india.com>
  parent: Benoît Bournon <benoit.bournon@adelis.com>
  2 siblings, 3 replies; 9+ messages in thread

From: Rajesh Kumar Mallah @ 2003-07-13 06:47 UTC (permalink / raw)
  To: Benoît Bournon <benoit.bournon@adelis.com>; pgsql-sql


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




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-15 06:42  Benoît Bournon <benoit.bournon@adelis.com>
  parent: Rajesh Kumar Mallah <mallah@trade-india.com>
  2 siblings, 0 replies; 9+ messages in thread

From: Benoît Bournon @ 2003-07-15 06:42 UTC (permalink / raw)
  To: ; +Cc: pgsql-sql

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
>
>  
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-17 06:39  Benoît Bournon <benoit.bournon@adelis.com>
  parent: Rajesh Kumar Mallah <mallah@trade-india.com>
  2 siblings, 0 replies; 9+ messages in thread

From: Benoît Bournon @ 2003-07-17 06:39 UTC (permalink / raw)
  To: ; +Cc: pgsql-sql

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
>
>  
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-17 06:44  BenLaKnet <benlaknet@icqmail.com>
  parent: Rajesh Kumar Mallah <mallah@trade-india.com>
  2 siblings, 1 reply; 9+ messages in thread

From: BenLaKnet @ 2003-07-17 06:44 UTC (permalink / raw)
  To: ; +Cc: pgsql-sql

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
>
>  
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-17 17:42  Joe Conway <mail@joeconway.com>
  parent: BenLaKnet <benlaknet@icqmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Joe Conway @ 2003-07-17 17:42 UTC (permalink / raw)
  To: BenLaKnet <benlaknet@icqmail.com>; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Recursive request ...
@ 2003-07-18 06:00  Greg Stark <gsstark@mit.edu>
  parent: Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Greg Stark @ 2003-07-18 06:00 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: BenLaKnet <benlaknet@icqmail.com>; pgsql-sql

Joe Conway <mail@joeconway.com> 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




^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2003-07-18 06:00 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 15:27 Recursive request ... Benoît Bournon <benoit.bournon@adelis.com>
2003-07-10 07:44 ` Joe Conway <mail@joeconway.com>
2003-07-10 13:32 ` Rod Taylor <rbt@rbt.ca>
2003-07-13 06:47 ` Rajesh Kumar Mallah <mallah@trade-india.com>
2003-07-15 06:42   ` Benoît Bournon <benoit.bournon@adelis.com>
2003-07-17 06:39   ` Benoît Bournon <benoit.bournon@adelis.com>
2003-07-17 06:44   ` BenLaKnet <benlaknet@icqmail.com>
2003-07-17 17:42     ` Joe Conway <mail@joeconway.com>
2003-07-18 06:00       ` Greg Stark <gsstark@mit.edu>

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