Permalink
Browse files

MDL-27685 fix pg LIKE escape trouble

  • Loading branch information...
1 parent 4b85dc1 commit e4ff5b5d74d85026d59a5f7609bf691b770d8889 @skodak skodak committed Aug 7, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/dml/pgsql_native_moodle_database.php
@@ -277,12 +277,12 @@ public function get_tables($usecache=true) {
return $this->tables;
}
$this->tables = array();
- $prefix = str_replace('_', '\\\\_', $this->prefix);
+ $prefix = str_replace('_', '|_', $this->prefix);
// Get them from information_schema instead of catalog as far as
// we want to get only own session temp objects (catalog returns all)
$sql = "SELECT table_name
FROM information_schema.tables
- WHERE table_name LIKE '$prefix%'
+ WHERE table_name LIKE '$prefix%' ESCAPE '|'
AND table_type IN ('BASE TABLE', 'LOCAL TEMPORARY')";
$this->query_start($sql, null, SQL_QUERY_AUX);
$result = pg_query($this->pgsql, $sql);

0 comments on commit e4ff5b5

Please sign in to comment.