Moodle
  1. Moodle
  2. MDL-27685

Select statement causes "Warning" messages on postgres

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1.1, 2.2
    • Fix Version/s: 2.0.5, 2.1.2
    • Labels:
    • Environment:
      SLES 11 SP1
      Moodle 2.0.2+ (Build: 20110413)
      Postgres 8.3.11
      Apache 5.2.14
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      no testing should be necessary because this is an obvious bug

      Show
      no testing should be necessary because this is an obvious bug
    • Workaround:
      Hide

      The select statement is locate in file "moodle\lib\dml\pgsql_native_moodle_database.php" on function get_tables($usecache=true).
      To solve the warning messages change line "$prefix = str_replace('_', '\\\\_', $this->prefix);" to "$prefix = $this->prefix;"

      I don't know if changing that line could cause others problems

      Show
      The select statement is locate in file "moodle\lib\dml\pgsql_native_moodle_database.php" on function get_tables($usecache=true). To solve the warning messages change line "$prefix = str_replace('_', '\\\\_', $this->prefix);" to "$prefix = $this->prefix;" I don't know if changing that line could cause others problems
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w31_MDL-27685_m22_pglike
    • Rank:
      17397

      Description

      Acessing the page "Site Administration"/"Notifications" generate the following messages on postgres log:

      WARNING: nonstandard use of \ \ in a string literal at character 107
      HINT: Use the escape string syntax for backslashes, e.g., E'\ \'.

      The select statement reported on postgres log is:
      SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'mdl_%' AND table_type IN ('BASE TABLE', 'LOCAL TEMPORARY')

      Replication instructions:

      1. Just access "Notification" page while watching the postgres log

        Activity

        Hide
        Sam Hemelryk added a comment -

        Thanks guys, this has been integrated now

        Show
        Sam Hemelryk added a comment - Thanks guys, this has been integrated now
        Hide
        Aparup Banerjee added a comment -

        tested anyway. (had to turn on my postgres logs)
        This works for me - warning is no more!

        Show
        Aparup Banerjee added a comment - tested anyway. (had to turn on my postgres logs) This works for me - warning is no more!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Sent upstream and closing, many thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - Sent upstream and closing, many thanks!
        Hide
        Derek Woolhead added a comment -

        I am adding a comment here as hopefully those involved with this issue will understand what I am talking about. Anyway, using postgres 9 we are experiencing a significant number of the same warnings due to the other occurrence of the ESCAPE character in "public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = '
        ')". We are of the opinion the default escape character should be changed to '|' rather than '
        ' for this function as well. Do you agree with this and should this be raised as a new issue or should this issue be re-opened?

        Show
        Derek Woolhead added a comment - I am adding a comment here as hopefully those involved with this issue will understand what I am talking about. Anyway, using postgres 9 we are experiencing a significant number of the same warnings due to the other occurrence of the ESCAPE character in "public function sql_like($fieldname, $param, $casesensitive = true, $accentsensitive = true, $notlike = false, $escapechar = ' ')". We are of the opinion the default escape character should be changed to '|' rather than ' ' for this function as well. Do you agree with this and should this be raised as a new issue or should this issue be re-opened?
        Hide
        Petr Škoda added a comment -

        Please do not reopen any closed issue, the reopening is now done only during the integration process. Instead please create a new issue, thanks.

        Show
        Petr Škoda added a comment - Please do not reopen any closed issue, the reopening is now done only during the integration process. Instead please create a new issue, thanks.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: