Re: Hirarchical queries a la Oracle. Patch.

Lists: pgsql-hackers
From: Evgen Potemkin <evgent(at)ns(dot)terminal(dot)ru>
To: <pgsql-hackers(at)postgresql(dot)org>
Cc: chester c young <chestercyoung(at)yahoo(dot)com>
Subject: Hirarchical queries a la Oracle. Patch.
Date: 2002-11-22 10:57:40
Message-ID: Pine.LNX.4.33.0211221455060.14684-100000@ns.terminal.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi there!

Patch is posted to pgsql-patches. docs inside.
SQL 99 version will be later.

regards,

---
.evgen


From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Evgen Potemkin <evgent(at)ns(dot)terminal(dot)ru>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, chester c young <chestercyoung(at)yahoo(dot)com>
Subject: Re: Hirarchical queries a la Oracle. Patch.
Date: 2002-11-26 20:59:53
Message-ID: 1038344392.1958.15.camel@rh72.home.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Evgen Potemkin kirjutas R, 22.11.2002 kell 15:57:
> Hi there!
>
> Patch is posted to pgsql-patches. docs inside.

It would of course be nice to support both Oracle and ISO/ANSI syntaxes,
but I'm afraid that the (+) may clash with our overloadable operators
feature.

> SQL 99 version will be later.

I attach a railroad diagram of SQL99 "WITH RECURSIVE" and a diff against
mid-summer gram.y which implements half of SQL99 _syntax_ (just the WITH
{RECURSIVE} part, SEARCH (tree search order order) and CYCLE (recursion
control) clauses are missing).

WITH clause seems to be quite useful in its own right as well, not just
for recursive queries, so I guess that someone with good knwledge of
postgresql internals could get plain WITH working quite fast -

The main difference between subqueries defined in WITH clause and in
FROM clause is that while subqueries in FROM don't see each other in
their namespaces, the ones in WITH either see all preceeding ones (plain
with) or just all in WITH clause (WITH RECURSIVE)

--------------
Hannu

Attachment Content-Type Size
image/gif 14.6 KB
with.clause.diff text/plain 2.8 KB

From: Evgen Potemkin <evgent(at)ns(dot)terminal(dot)ru>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hirarchical queries a la Oracle. Patch.
Date: 2002-11-28 17:34:14
Message-ID: Pine.LNX.4.33.0211282130260.319-100000@ns.terminal.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

thanks, it's VERY helpful.
understanding SQL99 draft is a bit more difficult than i thought :)

regards,

---
.evgen

On 27 Nov 2002, Hannu Krosing wrote:

> I attach a railroad diagram of SQL99 "WITH RECURSIVE" and a diff against
> mid-summer gram.y which implements half of SQL99 _syntax_ (just the WITH
> {RECURSIVE} part, SEARCH (tree search order order) and CYCLE (recursion
> control) clauses are missing).
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Evgen Potemkin <evgent(at)ns(dot)terminal(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hirarchical queries a la Oracle. Patch.
Date: 2002-11-28 23:06:02
Message-ID: 16960.1038524762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hannu Krosing <hannu(at)tm(dot)ee> writes:
> On Thu, 2002-11-28 at 17:34, Evgen Potemkin wrote:
>> understanding SQL99 draft is a bit more difficult than i thought :)

> You might also try to get DB2 installed somewhere (IIRC IBM gives out
> limited time developer copies).

Even without DB2 installed, you can read the documentation for it on the
web. There's quite a lot of useful info in IBM's docs. For example
http://nscpcw.physics.upenn.edu/db2_docs/db2s0/withsel.htm
and the example starting at
http://nscpcw.physics.upenn.edu/db2_docs/db2s0/db2s0446.htm

(The docs are probably also readable directly from IBM, but this is the
first copy I found by googling...)

regards, tom lane


From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Evgen Potemkin <evgent(at)ns(dot)terminal(dot)ru>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hirarchical queries a la Oracle. Patch.
Date: 2002-11-28 23:45:27
Message-ID: 1038527127.16020.1.camel@huli
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, 2002-11-28 at 17:34, Evgen Potemkin wrote:
> thanks, it's VERY helpful.
> understanding SQL99 draft is a bit more difficult than i thought :)

You might also try to get DB2 installed somewhere (IIRC IBM gives out
limited time developer copies).

It implements at least the basic recursive query (without requiring the word RECURSIVE :)

>
> --------------
> Hannu