Skip site navigation (1) Skip section navigation (2)

Re: functionality like Oracle's "connect by"

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: functionality like Oracle's "connect by"
Date: 2004-08-31 06:10:50
Message-ID: 877jrfhm6t.fsf@stark.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-general
"David Parker" <dparker(at)tazznetworks(dot)com> writes:

> The functionality I'm looking for is essentially the Oracle "connect
> by". Does anything like this exist for postgresql? 

Yes. In the contrib directory of the source is a directory named "tablefunc".
If you've installed from an distribution you might like for a
postgresql-contrib package or something like that.

It has a function that tries to do what you want:


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


I've never tried it though.

-- 
greg


In response to

pgsql-general by date

Next:From: Ulrich WisserDate: 2004-08-31 07:51:45
Subject: Re: Hebrew support -- please help !
Previous:From: Peter EisentrautDate: 2004-08-31 05:43:07
Subject: Re: psqlodbc-07.03.0200 --with-iodbc won7t compile on Mac OS X

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group