| From: | "Stephen R(dot) van den Berg" <srb(at)cuci(dot)nl> |
|---|---|
| To: | Jan Urba??ski <j(dot)urbanski(at)students(dot)mimuw(dot)edu(dot)pl> |
| Cc: | Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: proposal: Preference SQL |
| Date: | 2008-05-31 09:04:42 |
| Message-ID: | 20080531090442.GB8631@cuci.nl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Jan Urba??ski wrote:
>Preference SQL is an extension to regular SQL, that allows expressing
>preferences in SQL queries. Preferences are like "soft" WHERE clauses. A
>preference doesn't need to be satisfied by a tuple for it to appear in
>the result set, but it's "preferred" it is. More strictly, a set of
>preference clauses in a SQL query defines a partial order on the result
>set as it would appear without any preference clauses and then returns
>the maximal elements.
>An example of a preference query would be (quoting the linked PDF):
>SELECT * FROM programmers PREFERRING exp IN (???java???, ???C++???);
>or
>SELECT * FROM computers
>PREFERRING HIGHEST(main_memory) AND HIGHEST(cpu_speed);
Forgive my ignorance, but it appears that this can already be achieved
by using a properly weighted ORDER BY clause, as in:
SELECT * FROM computers
ORDER BY HIGHEST(main_memory) DESC, HIGHEST(cpu_speed) DESC;
--
Sincerely, srb(at)cuci(dot)nl
Stephen R. van den Berg.
"Sleep: A completely inadequate substitute for caffeine."
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jan Urbański | 2008-05-31 11:33:54 | Re: proposal: Preference SQL |
| Previous Message | Simon Riggs | 2008-05-31 07:34:34 | Re: Overhauling GUCS |