From 551a0f0a7634a6c71a49808a5ed59bcdc418aa49 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Fri, 10 Feb 2012 00:37:52 -0500 Subject: [PATCH] Note for other people. --- contrib/tag_history/main.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php index 054ee199..02f42948 100644 --- a/contrib/tag_history/main.php +++ b/contrib/tag_history/main.php @@ -366,6 +366,13 @@ class Tag_History extends Extension { if($entries > $allowed) { // TODO: Make these queries better + /* + MySQL does NOT allow you to modify the same table which you use in the SELECT part. + Which means that these will probably have to stay as TWO separate queries... + + http://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html + http://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause + */ $min_id = $database->get_one("SELECT MIN(id) FROM tag_histories WHERE image_id = ?", array($image->id)); $database->execute("DELETE FROM tag_histories WHERE id = ?", array($min_id)); }