Thread: Command "connect by prior" in PostgreSQL ?

Command "connect by prior" in PostgreSQL ?

From
"Leandro Repolho"
Date:
Hello everybody,
In Oracle i use the command "connect by prior" and i need to use it in PostgreSQL, what is the sintax?

Re: Command "connect by prior" in PostgreSQL ?

From
"Shoaib Mir"
Date:
There is no default support but you can always use connectby() function from the tablefunc contrib module....

--------------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com )

On 1/8/07, Leandro Repolho <leandrorepolho@gmail.com> wrote:
Hello everybody,
In Oracle i use the command "connect by prior" and i need to use it in PostgreSQL, what is the sintax?

Re: Command "connect by prior" in PostgreSQL ?

From
Scott Marlowe
Date:
On Mon, 2007-01-08 at 07:38, Leandro Repolho wrote:
> Hello everybody,
> In Oracle i use the command "connect by prior" and i need to use it in
> PostgreSQL, what is the sintax?

What does connect by prior do?  Reuse a connection from one db to
another?  I don't think there's anything like that in postgresql.

You might wanna tell us what an oracle command does next time, since
many folks here aren't that familiar with Oracle.  Heck, I use oracle
everyday and I'm not familiar with connect by prior...

Re: Command "connect by prior" in PostgreSQL ?

From
"Shoaib Mir"
Date:
It is used for Hierarchical queries in Oracle :)

----------------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 1/8/07, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
On Mon, 2007-01-08 at 07:38, Leandro Repolho wrote:
> Hello everybody,
> In Oracle i use the command "connect by prior" and i need to use it in
> PostgreSQL, what is the sintax?

What does connect by prior do?  Reuse a connection from one db to
another?  I don't think there's anything like that in postgresql.

You might wanna tell us what an oracle command does next time, since
many folks here aren't that familiar with Oracle.  Heck, I use oracle
everyday and I'm not familiar with connect by prior...

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

Re: Command "connect by prior" in PostgreSQL ?

From
Thomas Kellerer
Date:
On 08.01.2007 17:24 Scott Marlowe wrote:
> On Mon, 2007-01-08 at 07:38, Leandro Repolho wrote:
>> Hello everybody,
>> In Oracle i use the command "connect by prior" and i need to use it in
>> PostgreSQL, what is the sintax?
>
> What does connect by prior do?  Reuse a connection from one db to
> another?  I don't think there's anything like that in postgresql.
>
> You might wanna tell us what an oracle command does next time, since
> many folks here aren't that familiar with Oracle.  Heck, I use oracle
> everyday and I'm not familiar with connect by prior...

It's used to retrieve hierarchical data e.g. a parent/child
relationship. The connect by operator defines the columns which define
the hierarchy.

Thomas

Re: Command "connect by prior" in PostgreSQL ?

From
John Sidney-Woollett
Date:
Take a look at contrib/tablefunc there is a function called connectby()
that should do what you're looking for.

Otherwise roll your own...

http://archives.postgresql.org/pgsql-sql/2003-10/msg00374.php

John

Thomas Kellerer wrote:
> On 08.01.2007 17:24 Scott Marlowe wrote:
>> On Mon, 2007-01-08 at 07:38, Leandro Repolho wrote:
>>> Hello everybody,
>>> In Oracle i use the command "connect by prior" and i need to use it in
>>> PostgreSQL, what is the sintax?
>>
>> What does connect by prior do?  Reuse a connection from one db to
>> another?  I don't think there's anything like that in postgresql.
>> You might wanna tell us what an oracle command does next time, since
>> many folks here aren't that familiar with Oracle.  Heck, I use oracle
>> everyday and I'm not familiar with connect by prior...
>
> It's used to retrieve hierarchical data e.g. a parent/child
> relationship. The connect by operator defines the columns which define
> the hierarchy.
>
> Thomas
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

Re: Command "connect by prior" in PostgreSQL ?

From
Guy Rouillier
Date:
Leandro Repolho wrote:
> Hello everybody,
> In Oracle i use the command "connect by prior" and i need to use it in
> PostgreSQL, what is the sintax?

The last time I saw this discussed, Tom Lane referred to a "pg-hier"
modification but said this: "Beware that it makes an
incompatible change in rule representation, which means you must initdb
when installing or removing it."  I was unable to find pg-hier in a
quick cruise through PgFoundry.

--
Guy Rouillier



Re: Command "connect by prior" in PostgreSQL ?

From
"Matt Miller"
Date:
> > In Oracle i use the command "connect by prior" and i need to use it in
> > PostgreSQL, what is the sintax?
>
> I was unable to find pg-hier in a quick cruise through PgFoundry.

Try http://gppl.moonbone.ru/

The patch is not yet fixed to 8.2.0.  8.1.2 looks to be the latest.