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

Course restore not possible on PostgreSQL server with "standard_conforming_strings" enabled

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.2.3
    • None
    • Backup
    • Linux version 2.6.32.33-grsec (root@xxx.xx) (gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1))
      PostgreSQL 9.1.3
    • PostgreSQL
    • MOODLE_22_STABLE
    • Hide

      In postgresql.conf, set "standard_conforming_strings = off".

      Show
      In postgresql.conf, set "standard_conforming_strings = off".

    Description

      Related to MDL-26351, PULL-276:

      If you try to restore a course backup (only tried it with a 1.9 file) and have set "standard_conforming_strings = on" (which is the default for PostgreSQL >= 9.1), the restore wizard halts at step 2, throwing:

      Debug info: ERROR: invalid escape string
      HINT: Escape string must be empty or one character.
      SELECT COUNT(*) FROM ( SELECT c.id,c.name,c.visible,c.sortorder,c.description,c.descriptionformat , ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance FROM mdl_course_categories c LEFT JOIN mdl_context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = 40) WHERE c.name ILIKE $1 ESCAPE '\\' ) sel
      [array (
      0 => '%%',
      )]
      Stack trace:
       
          line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
          line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
          line 1297 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
          line 1372 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
          line 1543 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
          line 171 of /backup/util/ui/restore_ui_components.php: call to moodle_database->count_records_sql()
          line 109 of /backup/util/ui/restore_ui_components.php: call to restore_search_base->search()
          line 229 of /backup/util/ui/renderer.php: call to restore_search_base->get_count()
          line 297 of /backup/util/ui/restore_ui_stage.class.php: call to core_backup_renderer->course_selector()
          line 67 of /backup/restore.php: call to restore_ui_stage_destination->display()

      Attachments

        Issue Links

          Activity

            People

              poltawski Dan Poltawski
              johannes.albert Johannes Albert
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: