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

Column alias in get_backup_status_array query causes cron to fail

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 2.3, 2.4
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Backup
    • Labels:
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      Test pre-requisites

      • One course at least
      • Automated backups enabled
      • To be tested on all major DB engines

      Test steps

      1. Run the cli `php admin/cli/automated_backups.php`
      2. Make sure no errors/exception appear during the process
      3. Make sure the admin receive the email at the end
      Show
      Test pre-requisites One course at least Automated backups enabled To be tested on all major DB engines Test steps Run the cli `php admin/cli/automated_backups.php` Make sure no errors/exception appear during the process Make sure the admin receive the email at the end
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE

      Description

      Cron running on Moodle 2.3 finishes with this error:

      Backing up Careers...complete - next execution: Wednesday, 18 July 2012, 2:00 AM
      Backing up Data Analysis...complete - next execution: Wednesday, 18 July 2012, 2:00 AM
      Backing up 12 Legal Studies...complete - next execution: Wednesday, 18 July 2012, 2:00 AM
      Sending email to admin
      !!! Error reading from database !!!

      Postgres version is:
      PostgreSQL 8.3.14 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]

      It looks to be because the query in get_backup_status_array() is missing an "AS" for aliasing one of the columns.

      PostgreSQL 8.3 requires the "AS" to alias a column. See here http://www.postgresql.org/docs/8.3/static/sql-select.html

        Gliffy Diagrams

          Activity

          Hide
          salvetore Michael de Raadt added a comment -

          Thanks for spotting that and providing an patch.

          Show
          salvetore Michael de Raadt added a comment - Thanks for spotting that and providing an patch.
          Hide
          fred Frédéric Massart added a comment -

          Thanks for the patch Nathan. This looks good, I'm pushing for Integration.

          Show
          fred Frédéric Massart added a comment - Thanks for the patch Nathan. This looks good, I'm pushing for Integration.
          Hide
          poltawski Dan Poltawski added a comment -

          You pushed for peer review. Looks good, but we could do with some testing instructions.

          Show
          poltawski Dan Poltawski added a comment - You pushed for peer review. Looks good, but we could do with some testing instructions.
          Hide
          fred Frédéric Massart added a comment -

          Forgot about those, here they are.

          Show
          fred Frédéric Massart added a comment - Forgot about those, here they are.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          FYI: I've amended the commit to use uppercase "AS" SQL keyword.

          Integrated (22, 23 and master), thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - FYI: I've amended the commit to use uppercase "AS" SQL keyword. Integrated (22, 23 and master), thanks!
          Hide
          poltawski Dan Poltawski added a comment - - edited

          Postgres:
          MySQL:
          MSSQL:

          Show
          poltawski Dan Poltawski added a comment - - edited Postgres: MySQL: MSSQL:
          Hide
          poltawski Dan Poltawski added a comment -

          Oracle:

          Show
          poltawski Dan Poltawski added a comment - Oracle:
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          YEAR!*

          CAF*, TOT!*

          • Your effort amazingly resulted. (unbelievable :-P)
          • Closing as fixed.
          • Tons of thanks.
          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - YEAR!* CAF*, TOT!* Your effort amazingly resulted. (unbelievable :-P) Closing as fixed. Tons of thanks.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Sep/12