Re: [Sqlalchemy-tickets] [sqlalchemy] #1068: render 'SELECT foo() AS x .. ORDER BY x' by default
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2008-08-24 20:08:10
|
#1068: render 'SELECT foo() AS x .. ORDER BY x' by default ----------------------------------+----------------------------------------- Reporter: jek | Owner: anyone Type: enhancement | Status: new Priority: medium | Milestone: 0.5.xx Component: sql | Severity: major - 1-3 hours Resolution: | Keywords: Status_field: needs a volunteer | ----------------------------------+----------------------------------------- Changes (by zzzeek): * severity: no triage selected yet => major - 1-3 hours Comment: just a few thoughts here: * the work to be done here is to do a check if a label used within ORDER BY is present in the select() construct being rendered. * Postgres has a more strict policy regarding labels in ORDER BY - you can't embed the label into an expression of its own, it has to stand by itself with an optional ASC or DESC and that's it. * sqlite and mysql allow the label to be further calculated in an expression * I didn't check, but I have a feeling that labels cannot be used in the WHERE clause with postgres. I'm also fairly certain (again didn't check) that Oracle never allows labels in WHERE or ORDER BY. * I'm gathering that MySQL allows the label to be used anywhere. * The compiler will probably limit its search for the label to the columns clause of the select() construct that is currently at the top of the "select stack". * A lot of effort is needed with testing here (the tests I did are obviously not enough). * The whole feature is strictly a more natural and convenient way of issuing an optimization that is available in any case, by forcing usage of a label name with `column('name')`. -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1068#comment:13> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |