MDL-17492 Reset flag did not work in PostgreSQL. Merged from 1.9
authormudrd8mz <mudrd8mz>
Mon, 2 Mar 2009 21:45:08 +0000 (21:45 +0000)
committermudrd8mz <mudrd8mz>
Mon, 2 Mar 2009 21:45:08 +0000 (21:45 +0000)
Postgres does not seem to support table alias in UPDATE statement.
Therefore the SQL like
 UPDATE mdl_tag tg SET tg.flag = 0, tg.timemodified = 1236027984 WHERE tg.id IN (4)
ends with an ERROR: column "tg" of relation "mdl_tag" does not exist
The fix is quite easy - just do not use table alias as it makes no sense
here anyway.

tag/lib.php

index 5c6229d3a9fe7247e5ad6de734bc184cc75ba5ed..e5f1ac1ea21b34e41bcb16ebc8a44ebb015ce643 100644 (file)
@@ -1026,7 +1026,7 @@ function tag_unset_flag($tagids) {
         $tagids = implode(',', $tagids);
     }
     $timemodified = time();
-    return $DB->execute("UPDATE {tag} tg SET tg.flag = 0, tg.timemodified = ? WHERE tg.id IN ($tagids)", array($timemodified));
+    return $DB->execute("UPDATE {tag} SET flag = 0, timemodified = ? WHERE id IN ($tagids)", array($timemodified));
 }
 
 ?>