← Back to team overview

mahara-contributors team mailing list archive

[Bug 1836325] Re: Group search fails when Group Category is specified

 

** Changed in: mahara
    Milestone: None => 19.10.0

** Changed in: mahara
       Status: New => Fix Committed

** Changed in: mahara
   Importance: Undecided => High

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1836325

Title:
  Group search fails when Group Category is specified

Status in Mahara:
  Fix Committed
Status in Mahara 19.04 series:
  Fix Committed
Status in Mahara 19.10 series:
  Fix Committed

Bug description:
  Mahara: 19.04.0
  Linux: 16.04
  DB: Postgres
  Browser: FF

  
  If a group search is conducted when a group with a '.' in the name and a category is specified, the following error occurs:

  
  WAR] 3c (lib/errors.php:858) Failed to get a recordset: postgres8 error: [-1: ERROR:  invalid input syntax for integer: "19.04"] in EXECUTE("SELECT COUNT(*) FROM "group" g
              INNER JOIN (
                  SELECT g.id, 'admin' AS membershiptype, '' AS reason, 'admin' AS role
                  FROM "group" g
                  INNER JOIN "group_member" gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
                  UNION
                  SELECT g.id, 'member' AS membershiptype, '' AS reason, gm.role AS role
                  FROM "group" g
                  INNER JOIN "group_member" gm ON (g.id = gm.group AND gm.member = ? AND gm.role != 'admin')
                  UNION
                  SELECT g.id, 'invite' AS membershiptype, gmi.reason, gmi.role
                  FROM "group" g
                  INNER JOIN "group_member_invite" gmi ON (gmi.group = g.id AND gmi.member = ?)
                  UNION SELECT g.id, 'request' AS membershiptype, gmr.reason, '' AS role
                  FROM "group" g
                  INNER JOIN "group_member_request" gmr ON (gmr.group = g.id AND gmr.member = ?)
              ) t ON t.id = g.id WHERE g.deleted = ?
              AND (
                  g.name ILIKE '%' || ? || '%'
                  OR g.description ILIKE '%' || ? || '%'
                  OR g.shortname ILIKE '%' || ? || '%'
              ) AND g.category = ?")Command was: SELECT COUNT(*) FROM "group" g
              INNER JOIN (
                  SELECT g.id, 'admin' AS membershiptype, '' AS reason, 'admin' AS role
                  FROM "group" g
                  INNER JOIN "group_member" gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
                  UNION
                  SELECT g.id, 'member' AS membershiptype, '' AS reason, gm.role AS role
                  FROM "group" g
                  INNER JOIN "group_member" gm ON (g.id = gm.group AND gm.member = ? AND gm.role != 'admin')
                  UNION
                  SELECT g.id, 'invite' AS membershiptype, gmi.reason, gmi.role
                  FROM "group" g
                  INNER JOIN "group_member_invite" gmi ON (gmi.group = g.id AND gmi.member = ?)
                  UNION SELECT g.id, 'request' AS membershiptype, gmr.reason, '' AS role
                  FROM "group" g
                  INNER JOIN "group_member_request" gmr ON (gmr.group = g.id AND gmr.member = ?)
              ) t ON t.id = g.id WHERE g.deleted = ?
              AND (
                  g.name ILIKE '%' || ? || '%'
                  OR g.description ILIKE '%' || ? || '%'
                  OR g.shortname ILIKE '%' || ? || '%'
              ) AND g.category = ? and values was (0:2,1:2,2:2,3:2,4:0,5:2,6:19.04,7:19.04,8:19.04)
  Call stack (most recent first):

      log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /var/www/mahara/htdocs/lib/errors.php:95
      log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/mahara/htdocs/lib/errors.php:858
      SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/mahara/htdocs/lib/dml.php:517
      get_recordset_sql("SELECT COUNT(*) FROM "group" g INNER ...", array(size 9)) at /var/www/mahara/htdocs/lib/dml.php:276
      count_records_sql("SELECT COUNT(*) FROM {group} g INNER ...", array(size 9)) at /var/www/mahara/htdocs/lib/group.php:2288
      group_get_associated_groups("2", "all", 10, 0, 2, "19.04") at /var/www/mahara/htdocs/group/index.php:146


  
  The issue is not due to the '.' in the group name but rather because the SQL is incorrectly applying the values. i.e. $catsql and $query_where are concatenated in the wrong order in group_get_associated_groups().

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1836325/+subscriptions


References