Moodle
  1. Moodle
  2. MDL-34372

Column alias in get_backup_status_array query causes cron to fail

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical 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
    • Rank:
      42754

      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

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for spotting that and providing an patch.

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

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

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

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

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

        Forgot about those, here they are.

        Show
        Frédéric Massart added a comment - Forgot about those, here they are.
        Hide
        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
        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
        Dan Poltawski added a comment - - edited

        Postgres:
        MySQL:
        MSSQL:

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

        Oracle:

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

        YEAR!*

        CAF*, TOT!*

        • Your effort amazingly resulted. (unbelievable :-P)
        • Closing as fixed.
        • Tons of thanks.
        Show
        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: