473,387 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hierarchical query's

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

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike N. | last post by:
Hello to all: First let me apologize for the length of this question, I've made an attempt to include as much information as is needed to help with the question. I am having problems putting...
13
by: Anton.Nikiforov | last post by:
Hello everybody! Does someone know how to build hierarchical queries to the postgresql? I have a table with tree in it (id, parent) and need to find a way from any point of the tree to any...
1
by: News Server | last post by:
Any help appreciated. I have two Access tables, customer and orders. I would like to create a truly hierarchical xml file form the joined tables. I need to produce: <Query1> <Customer>...
4
by: Daisy | last post by:
Let's say I've got a forum, where users can be moderators of each forum. Tables look like this: USER -------- user_key name FORUM
5
by: clintonG | last post by:
I'm looking for documentation and would not turn my nose up to any code from anybody who thinks they are good at the design of an algorythm that can be used to generated a hierarchical relational...
3
by: Bennett Haselton | last post by:
I want to display a hierarchical listing of items from a database table, where, say, each row in the table has an "ID" field and a "parent_id" field giving the ID of its parent (NULL if it's at the...
1
by: rose74 | last post by:
hi i'd like to know how can i merge two hierarchical trees together. for instnace to query for each deparatment all its employees with considering to the employees hierarchicy (managers-employees).
12
by: Steve | last post by:
I have been studying the Adjacency List Model as a means of achieving a folder structure in a project I am working on. Started with the excellent article by Gijs Van Tulder ...
30
by: Vadim Tropashko | last post by:
Reposting with more clarification (as Jan asked). Suppose I have a BNFgrammar and a source text parsed into a tree. How would I query an identifier declaration? All the XQuery tutorials...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.