By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

Hierarchical query's

P: n/a
Hello!

Oracle has the option with the SQL CONECT BY statement to run through a hierarchical database with a single SQl-statement:

<!--SQL SELECT ms_id,ms_parent FROM messages CONNECT BY PRIOR ms_id = ms_parent START WITH ms_id = 1 -->

Result-set (example):

ms_id parent_id 1 1.1 1 1.1.1 1.1 1.1.2 1.1 1.1.3 1.1 1.2 1 1.2.1 1.2

etc
I need to do this in PostgreSql.

This is possible in the Postgre?
regards,
ClŠudia Morgado and Carla Mello

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

ClŠudia Morgado <cl*************@widesoft.com.br> writes:
Oracle has the option with the SQL CONECT BY statement to run through a
hierarchical database with a single SQl-statement:


Not really.

There is a package in the contrib directory called tablefunc that has a
function called connect_by that can do some things like this. I have no
experience with it and don't know if it would meet your needs.

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

Nov 12 '05 #2

P: n/a
Hello

PostgreSQL doesn't support h.q and I will not support this type of h.q.
Supported syntax will be like db2 - ANSI SQL 2kx. But you can try hier
patch - http://gppl.terminal.ru/readme.html.

This is a patch which allows PgSQL to perform hierarchical queries like
Oracle does.

Regards
Pavel Stehule
On Thu, 23 Oct 2003, [iso-8859-1] ClŠudia Morgado wrote:
Hello!

Oracle has the option with the SQL CONECT BY statement to run through a hierarchical database with a single SQl-statement:

<!--SQL SELECT ms_id,ms_parent FROM messages CONNECT BY PRIOR ms_id = ms_parent START WITH ms_id = 1 -->

Result-set (example):

ms_id parent_id 1 1.1 1 1.1.1 1.1 1.1.2 1.1 1.1.3 1.1 1.2 1 1.2.1 1.2

etc
I need to do this in PostgreSql.

This is possible in the Postgre?
regards,
ClŠudia Morgado and Carla Mello

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #3

P: n/a
Thanks very much!

We will go to do the tests.

Regards,
Carla Mello and ClŠudia Morgado
----- Original Message -----
From: "Pavel Stehule" <st*****@kix.fsv.cvut.cz>
To: "ClŠudia Morgado" <cl*************@widesoft.com.br>
Cc: <pg***********@postgresql.org>; <cm*****@wide.com.br>
Sent: Friday, October 24, 2003 3:32 AM
Subject: Re: [GENERAL] Hierarchical query's

Hello

PostgreSQL doesn't support h.q and I will not support this type of h.q.
Supported syntax will be like db2 - ANSI SQL 2kx. But you can try hier
patch - http://gppl.terminal.ru/readme.html.

This is a patch which allows PgSQL to perform hierarchical queries like
Oracle does.

Regards
Pavel Stehule
On Thu, 23 Oct 2003, [iso-8859-1] ClŠudia Morgado wrote:
Hello!

Oracle has the option with the SQL CONECT BY statement to run through a hierarchical database with a single SQl-statement:
<!--SQL SELECT ms_id,ms_parent FROM messages CONNECT BY PRIOR ms_id = ms_parent START WITH ms_id = 1 -->
Result-set (example):

ms_id parent_id 1 1.1 1 1.1.1 1.1 1.1.2 1.1 1.1.3 1.1 1.2 1 1.2.1 1.2

etc
I need to do this in PostgreSql.

This is possible in the Postgre?
regards,
ClŠudia Morgado and Carla Mello

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.