Re: Modifying SQL parser with extensions?

From: Matthias Luedtke <matthias-luedtke(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Modifying SQL parser with extensions?
Date: 2006-10-29 19:23:12
Message-ID: 4544FFA0.1010306@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Alvaro Herrera wrote:
>> In fact, parsing this SQL dialect would just be the first step, as the
>> annotations within the query induce an ordering of the result set.
>
> Huh, what is this supposed to be able to do that you can't do with the
> already existing ORDER BY clause?

Basically, conditional statements are annotated with integers that
represent weights, like

(...)WHERE (foo = 'a')[42] OR (bar = 'b')[20]

In the result set those entries that fulfill both conditions yield score
62, i.e. 42+20, and are ranked top, whereas entries that fulfill only
one of the conditions yield scores 42 and 20 respectively and are
therefore ranked lower.

Honestly, I'm only the poor student who has to implement what the
smarter ones have thought out. ;)

And, yes, it is possible to accomplish the desired sorting with the
ORDER BY clause, but as conditions become more complex, the self cooked
dialect is considered to be more readable and intuitive to the end user.

Regards,
Matthias

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ajay kamath 2006-10-29 19:23:24 Help Needed in Postgis
Previous Message Alvaro Herrera 2006-10-29 17:51:34 Re: Modifying SQL parser with extensions?