[MDEV-18125] JSON_VALUE broken in functions Created: 2019-01-03 Updated: 2019-04-29 Resolved: 2019-04-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.2.21 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Toshko Andreev | Assignee: | Alexander Barkov |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04 x64 |
||
| Issue Links: |
|
||||||||
| Description |
|
We have found a serious problem with JSON_VALUE which apparently was partially fixed in 10.2.16. Specifically we're extracting a Date from JSON and if that extraction is in a function it does not work. ERROR: Truncated incorrect datetime value: '2018-07-26T00:00:00+03:00' If the extraction is done from the query (ie no function that does it) then it works fine. Please see the following example:
|
| Comments |
| Comment by Alice Sherepa [ 2019-01-03 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
There is a warning after truncation anyway, but inside the function server returns error.
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-04-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
MariaDB does not support yet timestamp format with time zone. This will be done in MDEV-11829. So the warning happens because of the '+03:00' part in the timestamp string. If you remove the '+03:00' part it works without warnings or errors:
Possible workarounds: Use empty sql_mode at the function creation timeThis will suppress converting warnings to errors inside the stored function:
Remove the '+03:00' part before passing the value to date()The warning will disappear. If can be LEFT(datestr, 19) in simple cases, or REGEXP_SUBSTR(datexpr,'...') in more complex cases.
|