IvorySQL / IvorySQL

Open Source Oracle Compatible PostgreSQL.
https://ivorysql.org
Apache License 2.0
840 stars 144 forks source link

I would like IvorySQL to have oracle hierarchical queries support #28

Closed rasifr closed 2 years ago

rasifr commented 2 years ago

Hierarchical Query

Hierarchical queries are very useful to operate on hierarchical data. The PostgreSQL does not support it and It would be a good feature to add into the IvorySQL compatible list.

The usual clauses for a hierarchical query support are:

{ 
CONNECT BY [ NOCYCLE ] condition [AND condition]... [ START WITH condition ] 
| START WITH condition CONNECT BY [ NOCYCLE ] condition [AND condition]...
}

CONNECT BY The query syntax starts with CONNECT BY keywords which define the hierarchical interdependency between parent and child rows. The results must be further qualified by specifying the PRIOR keyword in the condition part for CONNECT BY clause.

The PRIOR keyword is a unary operator which links the previous row with the current one. The keyword can be used on the left or the right hand side of the equality condition. In case a loop is detected in the results, an error is returned to the user and the query aborted.

START WITH This clause specified from which row to start the hierarchy.

NOCYCLE This clause instructs to return data even if a cycle exists.

luss commented 2 years ago

+1. In my opinion this is of the same priority as the (+) syntax for outer joins (in case on or the other is more difficult to do).

--Luyss

On Wed, Dec 22, 2021 at 11:31 PM Asif Rehman @.***> wrote:

Hierarchical Query

Hierarchical queries are very useful to operate on hierarchical data. The PostgreSQL does not support it and It would be a good feature to add into the IvorySQL compatible list.

The usual clauses for a hierarchical query support are:

{ CONNECT BY [ NOCYCLE ] condition [AND condition]... [ START WITH condition ] | START WITH condition CONNECT BY [ NOCYCLE ] condition [AND condition]... }

CONNECT BY The query syntax starts with CONNECT BY keywords which define the hierarchical interdependency between parent and child rows. The results must be further qualified by specifying the PRIOR keyword in the condition part for CONNECT BY clause.

The PRIOR keyword is a unary operator which links the previous row with the current one. The keyword can be used on the left or the right hand side of the equality condition. In case a loop is detected in the results, an error is returned to the user and the query aborted.

START WITH This clause specified from which row to start the hierarchy.

NOCYCLE This clause instructs to return data even if a cycle exists.

— Reply to this email directly, view it on GitHub https://github.com/IvorySQL/IvorySQL/issues/28, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMWOHSRPXXN4Q3ZFBBCJ6DUSKQZFANCNFSM5KT6DT7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

luss commented 2 years ago

great stuff. this is important progress.

On Mon, Feb 28, 2022 at 2:33 AM Asif Rehman @.***> wrote:

Closed #28 https://github.com/IvorySQL/IvorySQL/issues/28 via #61 https://github.com/IvorySQL/IvorySQL/pull/61.

— Reply to this email directly, view it on GitHub https://github.com/IvorySQL/IvorySQL/issues/28#event-6152611402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMWOHRH6OBQ45A7X3NCDQDU5MQNVANCNFSM5KT6DT7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>