=?ISO-8859-1?Q?Matthias_L=FCdtke?= <matthias-luedtke@xxxxxx> writes: > 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. > So I need this extra information in the query to accomplish the > subsequent task of sorting the result set in a certain way before the > result is returned to the client. I'll have to use some hand crafted > internal data structures to do this sorting. Seems like you could save a large amount of work if you can express what you want to do as ORDER BY a user-defined operator. If you insist on bolting it on as new SQL syntax, changing the parser will be only the tip of the iceberg --- you'll likely need planner and executor changes as well. You could get a rough idea of what's involved in adding a new kind of query clause by looking at the last patch that did so: http://archives.postgresql.org/pgsql-committers/2006-08/msg00251.php regards, tom lane