← Back to team overview

mahara-contributors team mailing list archive

[Bug 1456849] [NEW] Problem with prepared statements in stats functions

 

Public bug reported:

 Failed to get a recordset: postgres8 error: [-1: number of parameters must be between 0 and 65535] in EXECUTE("
                SELECT (0.0 + COUNT(id)) / NULLIF(COUNT(DISTINCT "owner"), 0)
                FROM "view"
                WHERE id IN (?,? ... ?,?)
            and values was (2848,81339 ... 123,456)

The full error shows 65000+ question marks etc

There are a bunch of functions that generate stats but are poorly
written (in lib/registration.php I think) where it tries to get info by
passing in every user id that relates to the search as a prepared
statement value - but when we have too many users (like on Mahara.org)
it dies as there is a maximum number of ? we can have in prepared
statement before the underlying database chokes.

Need to rewrite the stats so that they scale better

** Affects: mahara
     Importance: High
     Assignee: Jono Mingard (mingard)
         Status: Confirmed

-- 
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/1456849

Title:
  Problem with prepared statements in stats functions

Status in Mahara ePortfolio:
  Confirmed

Bug description:
   Failed to get a recordset: postgres8 error: [-1: number of parameters must be between 0 and 65535] in EXECUTE("
                  SELECT (0.0 + COUNT(id)) / NULLIF(COUNT(DISTINCT "owner"), 0)
                  FROM "view"
                  WHERE id IN (?,? ... ?,?)
              and values was (2848,81339 ... 123,456)

  The full error shows 65000+ question marks etc

  There are a bunch of functions that generate stats but are poorly
  written (in lib/registration.php I think) where it tries to get info
  by passing in every user id that relates to the search as a prepared
  statement value - but when we have too many users (like on Mahara.org)
  it dies as there is a maximum number of ? we can have in prepared
  statement before the underlying database chokes.

  Need to rewrite the stats so that they scale better

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


Follow ups

References