Move validate_sql functionality into backend
|Reported by:||Christophe Pettus||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3-alpha|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Right now, RawQuery.validate_sql does one thing: It statically checks to see if the query begins with "SELECT". In the case of some backends (such as PostgreSQL), other statements can return sets, like FETCH (from a cursor) and DO. It would be great to use those in raw queries as well. Rather than just building up a large list in the function, I suggest that the list be moved into the backend, or the actual guts of validate_sql be delegated to it.