﻿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
18304	MySQL generates an unecessary select when updating inherited models	Anssi Kääriäinen	anonymous	"The reason is in !SQLUpdateCompiler.pre_sql_setup(): it checks if there are multiple tables in the query, and if the backend can't do a self select on update (""update_can_self_select"" db feature) the pre_sql_setup will run a query to fetch the pks to update. However, in inheritance cases this leads to queries like:
{{{
SELECT U0.`person_ptr_id` FROM `update_only_fields_employee` U0 WHERE U0.`person_ptr_id` = 2
}}}
which is non-necessary to run.

The problem was spotted when running update_only_fields tests on MySQL - the test will be skipped on MySQL, but the test_num_queries_inheritance test shows the problem if the skip is removed."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	mysql		Ready for checkin	1	1	1	1	1	1
