← Back to team overview

openerp-india team mailing list archive

[Bug 922198] [NEW] [trunk 6.1] res_users request to read field 'group_id' can generates twice same SQL request in read_flat

 

Public bug reported:

Hi,

In read, there is no check if the fields argument doesn't contain
multiple times the same field to read. It's not an issue if you are
careful and don't ask to request twice the same field otherwise 2 SQL
queries will be triggered.

The issue is in the read method of res.users (base/res/res_users.py line
853). You append the field 'groups_id' in the fields list even if it is
already in the list. When you request to read 'groups_id', it results in
two SQL requests to read that field in DB.

self.pool.get('res.users').read(cr, 1, uid, ['groups_id'])
[2012-01-26 17:01:46,143][?] DEBUG_SQL:db.cursor:query: SELECT res_groups_users_rel.gid, res_groups_users_rel.uid                    FROM res_groups_users_rel, "res_groups"                   WHERE res_groups_users_rel.uid IN (17)                     AND res_groups_users_rel.gid = res_groups.id                                                                         OFFSET 0
[2012-01-26 17:01:46,144][?] DEBUG_SQL:db.cursor:query: SELECT res_groups_users_rel.gid, res_groups_users_rel.uid                    FROM res_groups_users_rel, "res_groups"                   WHERE res_groups_users_rel.uid IN (17)                     AND res_groups_users_rel.gid = res_groups.id                                                                         OFFSET 0

kr,
J-E

** Affects: openobject-server
     Importance: Undecided
         Status: New


** Tags: mso

** Tags added: mso

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/922198

Title:
  [trunk 6.1] res_users request to read field 'group_id' can generates
  twice same SQL request in read_flat

Status in OpenERP Server:
  New

Bug description:
  Hi,

  In read, there is no check if the fields argument doesn't contain
  multiple times the same field to read. It's not an issue if you are
  careful and don't ask to request twice the same field otherwise 2 SQL
  queries will be triggered.

  The issue is in the read method of res.users (base/res/res_users.py
  line 853). You append the field 'groups_id' in the fields list even if
  it is already in the list. When you request to read 'groups_id', it
  results in two SQL requests to read that field in DB.

  self.pool.get('res.users').read(cr, 1, uid, ['groups_id'])
  [2012-01-26 17:01:46,143][?] DEBUG_SQL:db.cursor:query: SELECT res_groups_users_rel.gid, res_groups_users_rel.uid                    FROM res_groups_users_rel, "res_groups"                   WHERE res_groups_users_rel.uid IN (17)                     AND res_groups_users_rel.gid = res_groups.id                                                                         OFFSET 0
  [2012-01-26 17:01:46,144][?] DEBUG_SQL:db.cursor:query: SELECT res_groups_users_rel.gid, res_groups_users_rel.uid                    FROM res_groups_users_rel, "res_groups"                   WHERE res_groups_users_rel.uid IN (17)                     AND res_groups_users_rel.gid = res_groups.id                                                                         OFFSET 0

  kr,
  J-E

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/922198/+subscriptions


Follow ups

References