Moodle
  1. Moodle
  2. MDL-38487

match question restore db error on PostgreSQL

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.3, 2.4
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      You need a course with a lot of matching questions.

      Back it up and restore it, and verify there are no regressions.

      Try some variants like restoring into an existing course, or duplicating a quiz with matching questions.

      Show
      You need a course with a lot of matching questions. Back it up and restore it, and verify there are no regressions. Try some variants like restoring into an existing course, or duplicating a quiz with matching questions.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull 2.4 Branch:
    • Rank:
      48472

      Description

      When restoring course, with match questions, from backup moodle throughout an error message and stops the proccess:

      Debug info: ERROR: invalid input syntax for integer: ""

      PostgreSQL does not handle empty strings as integer values. Problem lies in question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php on line 190. Variable $subquestion could be empty string. This little code placed below line 189 solves the problem:

      if ($subquestion == '') {
          $subquestion = null;
      }
      

        Activity

        Hide
        Tim Hunt added a comment -

        I think this patch is a slighly better way to fix things.

        This error does not always happen. I can't reproduce it. Are you able to attach a file that demonstrates the problem which we can use for testing?

        Are you able to test this patch yourself?

        Also, not that this whole bit of code has been removed in Moodle 2.5+, so we are just looking for a temporary work-around for the stable branches.

        Show
        Tim Hunt added a comment - I think this patch is a slighly better way to fix things. This error does not always happen. I can't reproduce it. Are you able to attach a file that demonstrates the problem which we can use for testing? Are you able to test this patch yourself? Also, not that this whole bit of code has been removed in Moodle 2.5+, so we are just looking for a temporary work-around for the stable branches.
        Hide
        Dan Poltawski added a comment -

        Hi Tim,

        Code looks fine here. Would be good to have some testing instructions which go down that code path.

        I wonder if one of the postgres.conf computability options (http://www.postgresql.org/docs/9.1/static/runtime-config-compatible.html) prevents this warning?

        Show
        Dan Poltawski added a comment - Hi Tim, Code looks fine here. Would be good to have some testing instructions which go down that code path. I wonder if one of the postgres.conf computability options ( http://www.postgresql.org/docs/9.1/static/runtime-config-compatible.html ) prevents this warning?
        Hide
        Tim Hunt added a comment -

        Dan, I agree that some questions instructions would be good, but the time it would take for me to work that out makes it impossible.

        I had hoped that the original reporter would either supply a test file, or test the patch, but he hasn't.

        Therefore, I don't know what to do with this patch I made. I could either submit it for integration anyway, or close this as won't fix? I think I prefer the former of those two options.

        Show
        Tim Hunt added a comment - Dan, I agree that some questions instructions would be good, but the time it would take for me to work that out makes it impossible. I had hoped that the original reporter would either supply a test file, or test the patch, but he hasn't. Therefore, I don't know what to do with this patch I made. I could either submit it for integration anyway, or close this as won't fix? I think I prefer the former of those two options.
        Hide
        Tomasz Pawlik | CKO USl added a comment -

        Hello,

        sorry for the delay, but I'm so busy, ath the moment, I can't prepare any tast case for this.

        Error happend when I was importing content from one course to another.

        I can't see any postgres.conf option regarding this problem, either.

        Show
        Tomasz Pawlik | CKO USl added a comment - Hello, sorry for the delay, but I'm so busy, ath the moment, I can't prepare any tast case for this. Error happend when I was importing content from one course to another. I can't see any postgres.conf option regarding this problem, either.
        Hide
        Tim Hunt added a comment -

        I think this should be integrated, even though we don't have a way to test it. I don't see how it would cause harm, and in situations like the reporter's, it does good.

        Show
        Tim Hunt added a comment - I think this should be integrated, even though we don't have a way to test it. I don't see how it would cause harm, and in situations like the reporter's, it does good.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        No brainer, integrated (23 & 24), thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - No brainer, integrated (23 & 24), thanks!
        Hide
        Ankit Agarwal added a comment -

        Tested on a course with 30 matching questions. restored as a new/ into current course. No errors were seen.
        Passing
        Thanks

        Show
        Ankit Agarwal added a comment - Tested on a course with 30 matching questions. restored as a new/ into current course. No errors were seen. Passing Thanks
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Did you think this day was not going to arrive ever?

        Your patience has been rewarded, yay, sent upstream, thanks!

        Closing...ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Did you think this day was not going to arrive ever? Your patience has been rewarded, yay, sent upstream, thanks! Closing...ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: