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

Operator II does not exist (postgresql)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.2
    • Labels:
    • Environment:
      Ubuntu 10.04 LTS, Postgresql 8.4.5 Apache 2.2.14
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Site Administration -> Reports -> Statistics does not work (Error reading from database).
      Error on the apache log and postgresql log say:

      [Fri Dec 17 13:50:50 2010] [error] [client 142.244.122.135] Default exception handler: Error reading from database Debug: ERROR: operator does not exist: bigint || bigint\nLINE 1: SELECT timeend || roleid AS uniqueid, timeend, roleid, sum...\n ^\nHINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.\nSELECT timeend || roleid AS uniqueid, timeend, roleid, sum(stat1+stat2) as line1 FROM mdl_stats_daily WHERE stattype = 'activity' AND timeend >= 1291964400 GROUP BY timeend,roleid ORDER BY timeend DESC\n[array (\n)]\n* line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown\n* line 229 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()\n* line 669 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()\n* line 101 of /course/report/stats/report.php: call to pgsql_native_moodle_database->get_records_sql()\n* line 62 of /course/report/stats/index.php: call to require()\n, referer: https://eclass-pilot-test.srv.ualberta.ca/course/report/stats/index.php

      Suggestion: Replace logical OR operator from "||" to "OR" so it will work on both postgresql and mysql db. I'm not a 100% sure what the query is trying to achieve, but it appears to be used as a logical OR operator.

        Gliffy Diagrams

          Activity

          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment - - edited

          Hi Grzegorz,

          I think the problem there is not the "||" being considered logical operator, but PostgreSQL not being able to concatenate 2 integer fields (ERROR: operator does not exist: bigint || bigint).

          So I've done a quick fix for this. It is available at:

          https://github.com/stronk7/moodle/commit/4cf2e5d571096398142904879d1e888e557809e2

          perhaps you could apply it manually to your server to see if it solves the problem, any feedback will be really welcome.

          The fix will be hopefully applied to Moodle 2.0 soon and will be available in next weekly build (next Wednesday).

          Thanks for the report, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - - edited Hi Grzegorz, I think the problem there is not the "||" being considered logical operator, but PostgreSQL not being able to concatenate 2 integer fields (ERROR: operator does not exist: bigint || bigint). So I've done a quick fix for this. It is available at: https://github.com/stronk7/moodle/commit/4cf2e5d571096398142904879d1e888e557809e2 perhaps you could apply it manually to your server to see if it solves the problem, any feedback will be really welcome. The fix will be hopefully applied to Moodle 2.0 soon and will be available in next weekly build (next Wednesday). Thanks for the report, ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          I'm resolving this as fixed and will be integrated and tested by PULL-44. If everything goes ok will be available next Wednesday for download.

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - I'm resolving this as fixed and will be integrated and tested by PULL-44. If everything goes ok will be available next Wednesday for download. Ciao
          Hide
          greg_d128 Grzegorz Dostatni added a comment -

          Thank you. The patch did fix the problem on our end. I just hope commenting will not re-open the ticket

          Show
          greg_d128 Grzegorz Dostatni added a comment - Thank you. The patch did fix the problem on our end. I just hope commenting will not re-open the ticket
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Great, thanks!

          NP, commenting is open & free, but doesn't re-opens anything, lol!

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Great, thanks! NP, commenting is open & free, but doesn't re-opens anything, lol! Ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Closing as tests passed. Will land upstream in hours. Thanks and ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Closing as tests passed. Will land upstream in hours. Thanks and ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Feb/11