Re: [HACKERS] Hirarchical queries a la Oracle. Patch.

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Evgen Potemkin <evgent(at)ns(dot)terminal(dot)ru>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Hirarchical queries a la Oracle. Patch.
Date: 2002-11-26 22:21:48
Message-ID: 1038349308.1956.46.camel@rh72.home.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

I re-send this to -patches as I see that there has been some discussion
on this, though I think that the whole things should have been discussed
in -hackers first.
--------------------

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 a good feel 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 all in WITH clause (WITH RECURSIVE)

I myself got stuck in the part where the parse-tree was turned into a
query tree and as I was off-net, I could not ask ;( .
Later I was out of time again. ;( ;(

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

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

Browse pgsql-patches by date

  From Date Subject
Next Message Fernando Nasser 2002-11-26 23:27:43 Re: Hierarchical queries a la Oracle. Patch.
Previous Message Bruce Momjian 2002-11-26 19:21:01 Re: release note fixes (7.3 & HEAD)