On Jun 28, 5:46 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote: > i might be totally wrong (wouldn't be first time..) but i've found > myself having to adapt to local dialects almost every time i see some > SQL inside a function, especially on mysql and sqlite. maybe it's > because of the bad quality of code i tend to see (typically > originating from hand-coded mssql accesses deep within an excel > sheet), but seeing CASE also rings my "i'll need an extra week just > for this" alarm. >
I really do hope that the CASE WHEN construction can be used in all supported databases. I have high hopes that it can be used, because the CASE WHEN construction is one of the most standard constructions in SQL, and because I have tested it on MySQL 5.0, PostgreSQL 8.4, SQLite3 and Oracle 10g. I also attached a proof of concept patch to #11305. It is somewhat uqly, but I hope it is a good start. It should support aggregate() and annotate() for all the standard aggregates, and F() lookups should be usable with it. The restriction is that the Q-object used in the only condition can not add additional joins to the query. The patch is just a proof of concept, and it is safe to assume it will fail under more complicated queries. - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.