diff options
author | unknown <cmiller@calliope.local.cmiller/calliope.local> | 2007-02-09 11:05:36 +0100 |
---|---|---|
committer | unknown <cmiller@calliope.local.cmiller/calliope.local> | 2007-02-09 11:05:36 +0100 |
commit | 4c4f50623896f43873420d6c8d8e2a320653d57a (patch) | |
tree | e4f3edd1c02b0db566877054e2f4675234205a96 /mysql-test/t/order_by.test | |
parent | 0f462179dba195519661d91e49b76d65cb1ba618 (diff) | |
download | mariadb-git-4c4f50623896f43873420d6c8d8e2a320653d57a.tar.gz |
Bug#25126: Reference to non-existant column in UPDATE...ORDER BY... crashes server
"update existingtable set anycolumn=nonexisting order by nonexisting" would crash
the server.
Though we would find the reference to a field, that doesn't mean we can then use
it to set some values. It could be a reference to another field. If it is NULL,
don't try to use it to set values in the Item_field and instead return an error.
Over the previous patch, this signals an error at the location of the error, rather
than letting the subsequent deref signal it.
mysql-test/r/order_by.result:
Verify that all permutations work.
mysql-test/t/order_by.test:
Verify that all permutations work.
sql/item.cc:
When the field is NULL, don't dereference it when we set_field().
Instead, raise an error.
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r-- | mysql-test/t/order_by.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index a8024be7032..bfca5ddd15d 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -575,4 +575,34 @@ SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1; SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a; DROP TABLE t1; +# +# Bug#25126: Reference to non-existant column in UPDATE...ORDER BY... +# crashes server +# +CREATE TABLE bug25126 ( + val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY +); +--error 1054 +UPDATE bug25126 SET MissingCol = MissingCol; +--error 1054 +UPDATE bug25126 SET val = val ORDER BY MissingCol; +UPDATE bug25126 SET val = val ORDER BY val; +UPDATE bug25126 SET val = 1 ORDER BY val; +--error 1054 +UPDATE bug25126 SET val = 1 ORDER BY MissingCol; +--error 1054 +UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol; +--error 1054 +UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol; +--error 1054 +UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol; +--error 1054 +UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol; +--error 1054 +UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol; +--error 1054 +UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol; +DROP TABLE bug25126; + + # End of 4.1 tests |