Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Posts
    16

    Arrow Unanswered: how to write a recursive query

    my table schema isL: resourceid,name, parentresourceid.

    parentresourceid contains again a resourceid in the same table. so u can identity it as a tree structure.

    problem is that if i give a resourceid i need to get all the childs recursively.
    constraint is that this should be in a single query.
    plz give me immediate rep.
    thank u.
    :-)

  2. #2
    Join Date
    May 2002
    Location
    Florida, USA
    Posts
    49
    problem is that if i give a resourceid i need to get all the childs recursively.
    constraint is that this should be in a single query.
    PostgreSQL does not yet have the ability to do recursive queries, as with "CONNECT BY" in Oracle or MSSQL. This will probably be available with the next major release, version 7.4. You can get developer snapshots of 7.4 and start browsing the newsgroup comp.databases.postgresql.hackers if this is really important. But, I wouldn't recommend running a production system on a developer snapshot. (Look for snapshots in the /dev section of the PostgreSQL download mirrors)

    plz give me immediate rep.
    Don't push it when asking for free help ;-).

  3. #3
    Join Date
    Dec 2002
    Posts
    15
    Depending on the data involved, you may want to take a look at ltree in the contrib directory.

  4. #4
    Join Date
    May 2002
    Location
    Florida, USA
    Posts
    49
    There is a new project to imitate Oracle's hierarchical query method: http://gborg.postgresql.org/project/...rojdisplay.php

  5. #5
    Join Date
    Apr 2003
    Location
    Bucharest, RO
    Posts
    2

    Re: how to write a recursive query

    Naturally, you can work around this and build a tree in your application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •