[MDEV-13417] UPDATE produces wrong values if an updated column is later used as an update source Created: 2017-08-01 Updated: 2019-04-27 Resolved: 2018-02-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Update |
| Affects Version/s: | 10.0, 10.1, 10.2 |
| Fix Version/s: | 10.3.5 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Alexander Barkov | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Compatibility | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
This problem was originally reported by Jerome B. on the maria-developers list on 2017-07-21:
produces this result:
Other databases return 2 for all columns: PostgreSQL:
Oracle:
SQLite3:
MariaDB's behavior contradicts the SQL standard, which says in the section <update statement: searched>:
|
| Comments |
| Comment by Sergei Golubchik [ 2017-08-04 ] | ||
|
This is and always was the documented behavior. When fixing it, think of backward compatibility implications. | ||
| Comment by Elena Stepanova [ 2017-08-04 ] | ||
|
I'd rather it was closed as "Won't fix" (or, if it's required for the compatibility project, made somehow configurable, with the default behavior being the old one). I think fixing it will cause more troubles than gains. | ||
| Comment by Sergei Golubchik [ 2017-08-05 ] | ||
|
Yes, I think we'll have to have the standard behavior eventually. "made somehow configurable" — that's exactly what I implied in "think of backward compatibility implications". Options:
| ||
| Comment by Alexander Barkov [ 2017-08-11 ] | ||
|
I also do not like to do prior evaluation of <update source> only in ORACLE mode. Doing prior evaluation only in TRADITIONAL or ANSI mode also does not look good enough.
which looks not so convenient. I prefer to have a new sql_mode flag, and turn it on by default, to have all users get used with the standard behavior. However, STANDARD_UPDATE_BEHAVIOR sounds too optimistic, because there might be some other aspects of UPDATE (not related to the order of evaluation of value sources) that expose non-standard behavior Why not have something like this:
to activate the legacy non-standard behavior? |