Matthias Luedtke wrote: > > 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] Hummm, doesn't this sound suspiciously close to the "skyline" algorithm type stuff? AFAIU skyline allowed you to specify conditions and weights for each one, and redefined ORDER BY to work following those. In that case, I may as well point out that there's a couple of gals working on this. They hang out on the pgsql-es-ayuda list (in spanish). They have the grammar part working, at least. I think this particular example could be made work by using CASE constructs. I'm not sure how efficient or cumbersome that would turn out to be. (That particular notation has the drawback that the [n] would be interpreted as an array index though.) -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support