[MDEV-6624] Updating or deleteting on a CONNECT void table produces "unknown error" Created: 2014-08-21 Updated: 2014-09-06 Resolved: 2014-09-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.13 |
| Fix Version/s: | 10.0.14 |
| Type: | Bug | Priority: | Major |
| Reporter: | Olivier Bertrand | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When trying to do:
on the table:
in which no rows have been inserted yet or all rows deleted, results in the message:
This occurs despite the handler does not return any error code (it just pushes a warning) It seems that this occurs in mysql_update in sql_update.cc line 910:
I haven't the faintest idea of what this code does but in normal cases the error variable remains equal to -1 while in this case it is set to 122 causing the error. |
| Comments |
| Comment by Sergei Golubchik [ 2014-09-06 ] | |||||||
|
See the last line
as you can see, it sets the error to 1 if the query execution was killed, otherwise it keeps the old error value.
I'm not sure why you think that a not found key is an internal error, it can easily happen on, for example,
If I change the returned error code to HA_ERR_KEY_NOT_FOUND, then your test case works correctly. | |||||||
| Comment by Sergei Golubchik [ 2014-09-06 ] | |||||||
|
I did that change, all tests passed. I'm going to push it, unless you disagree. | |||||||
| Comment by Olivier Bertrand [ 2014-09-06 ] | |||||||
|
This did mask the error by chance but it is not the real cause. It is more complex: In index_read I normally call ReadIndexed that returns HA_ERR_KEY_NOT_FOUND n this case. Thanks for showing me where the problem comes from. | |||||||
| Comment by Olivier Bertrand [ 2014-09-06 ] | |||||||
|
The fix I have done is to accept the indexing which of course returns record not found in index_read. However, it is not quite what I wished to do because it seems that there is no way to tell MariaDB not to use indexing at all. Setting active_index to MAX_KEY does not work because when returning 0 it is set to idx in the calling function and returning an error value cause an error to be raised. I already met this problem and it would be nice to be able to do it, mainly because the SQL syntax does not allow ignoring indexes for not select statement. | |||||||
| Comment by Sergei Golubchik [ 2014-09-06 ] | |||||||
|
Okay, great. I will revert my fix then (it wasn't pushed yet). Thanks! |