Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-75160

Really support large number of SQL-IN parameters in Postgres

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.0.1
    • Database SQL/XMLDB
    • MOODLE_400_STABLE

      MDL-70055 got us part of the way there, but now instead of postgres complaining, PDO does. PDO stores the number of query params as an int, so it cannot exceed 65535. Running this script should produce an error even with MDL-70055 applied:

      <?php
       
      require_once('config.php');
       
      $usernames = array_map(function($i) {
          return "user$i";
      }, range(0,65535));
       
      [$insql, $params] = $DB->get_in_or_equal($usernames);
       
      $DB->get_records_sql("SELECT DISTINCT id FROM {user} WHERE username $insql", $params);
      

            Unassigned Unassigned
            cameron1729 cameron1729
            Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.