id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 1760,order_with_respect_to doesn't work with MySQL,Christopher Lenz ,nobody,"Inserting/updating an inline-edited object that has `order_with_respect_to` enabled results in the following traceback: {{{ Traceback (most recent call last): [snip] File ""lib/django/django/db/models/base.py"" in save File ""lib/django/django/db/backends/util.py"" in execute File ""lib/django/django/db/backends/mysql/base.py"" in execute File ""/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py"" in execute 137. self.errorhandler(self, exc, value) File ""/usr/lib64/python2.4/site-packages/MySQLdb/connections.py"" in defaulterrorhandler 33. raise errorclass, errorvalue OperationalError at /admin/products/productlocalization/4445/ (1093, ""You can't specify target table 'products_download' for update in FROM clause"") }}} The SQL query causing this problem is: {{{ #!sql INSERT INTO `products_download` (`product_id`,`title`,`file`,`type`,`_order`) VALUES (%s,%s,%s,%s,(SELECT COUNT(*) FROM `products_download` WHERE `product_id` = %s)) }}} Apparently this is due to a limitation of MySQL regarding subqueries, [http://dev.mysql.com/doc/refman/5.0/en/update.html documented] on the page describing the `UPDATE` statement: ''Currently, you cannot update a table and select from the same table in a subquery.''",defect,closed,"Database layer (models, ORM)",dev,normal,fixed,,farcepest@… simon@…,Ready for checkin,1,0,0,0,0,0