Commit graph

274 commits

Author SHA1 Message Date
Alexey Botchkov
a3ba8c3660 MDEV-13703 Illegal mix of collations for operation 'json_object' on
using JSON_UNQUOTE as an argument.

        The coercibility and repertoire should be set properly for the
        JSON_UNQUOTE.
2017-10-06 09:28:33 +04:00
Alexey Botchkov
f1a20ec396 MDEV-12311 Insufficient check for argument validity in JSON functions.
Check validity to the end of the JSON in the json_length
        function.
2017-10-05 23:46:25 +04:00
Alexey Botchkov
1f6ada8da8 MDEV-13306 JSON_CONTAINS returns wrong value.
The 'value' state should be saved to be compared against the
        next array item.
2017-10-05 23:23:39 +04:00
Marko Mäkelä
2c1067166d Merge bb-10.2-ext into 10.3 2017-10-04 08:24:06 +03:00
Alexander Barkov
8ae8cd6348 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-10-02 22:35:13 +04:00
Vladislav Vaintroub
7354dc6773 MDEV-13384 - misc Windows warnings fixed 2017-09-28 17:20:46 +00:00
Marko Mäkelä
348eaf4252 Merge bb-10.2-ext into 10.3 2017-09-14 09:12:47 +03:00
Marko Mäkelä
c97e504a5f Merge 10.2 into bb-10.2-ext 2017-09-14 08:09:44 +03:00
Alexey Botchkov
dc82f70e9f MDEV-13633 JSON_ARRAY() - bad output with some UTF8 characters.
set_charset() calls added for Item_func_json_arran
        and Item_func_json_object::val_str-s.
2017-09-13 15:17:28 +04:00
Alexander Barkov
178540b904 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-09-13 12:12:05 +04:00
Alexey Botchkov
a237a92099 MDEV-12877 Wrong result from JSON native function.
Set default charset for temporary paths so UDF call don't crash.
2017-09-13 00:36:09 +04:00
Alexey Botchkov
30db4e1fc7 MDEV-13786 compiler complains about uninitialized variable.
'=0' added to meke the compiler happy.
2017-09-12 15:33:30 +04:00
Alexey Botchkov
0cd731864e MDEV-13104 Json functions.
An extra ',' added to the JSON_MERGE result making it invalid.
2017-09-12 15:21:53 +04:00
Alexey Botchkov
467acc2119 MDEV-13324 JSON_SET returns NULL instead of object.
Superfluous ',' was added to the JSON_SET result so it became
        invalid.
2017-09-12 14:40:18 +04:00
Alexey Botchkov
6352ec2184 MDEV-12982 JSON_EXTRACT returns data for invalid JSON.
Let's check the validity to the end of the JSON.
2017-09-12 11:20:30 +04:00
Sergei Golubchik
bb8e99fdc3 Merge branch 'bb-10.2-ext' into 10.3 2017-08-26 00:34:43 +02:00
Sergei Golubchik
27412877db Merge branch '10.2' into bb-10.2-ext 2017-08-25 10:25:48 +02:00
Michael Widenius
4aaa38d26e Enusure that my_global.h is included first
- Added sql/mariadb.h file that should be included first by files in sql
  directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables
  that must be done before my_global.h is included)
- Removed a lot of include my_global.h from include files
- Removed include's of some files that my_global.h automatically includes
- Removed duplicated include's of my_sys.h
- Replaced include my_config.h with my_global.h
2017-08-24 01:05:44 +02:00
Sergei Golubchik
399e14f066 MDEV-13435 Crash when selecting virtual columns generated using JSON functions
don't allocate memory on thd->mem_root in every fix_fields(),
do it once and reuse.
2017-08-14 19:45:59 +02:00
Alexey Botchkov
2ebb1380d6 MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
JSON_EXTRACT behaves specifically in the comparison,
        so we have to implement specific method for that in
        Arg_comparator.

Conflicts:
	sql/item_cmpfunc.cc
2017-08-11 09:02:55 +04:00
Alexey Botchkov
79d2853354 MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
JSON_EXTRACT behaves specifically in the comparison,
        so we have to implement specific method for that in
        Arg_comparator.
2017-08-11 00:50:29 +04:00
Marko Mäkelä
0930d6698f Merge 10.2 into bb-10.2-ext 2017-08-09 12:35:21 +03:00
Alexey Botchkov
4bca34d8a4 MDEV-12789 JSON_KEYS returns duplicate keys twice.
Check for duplicating keys added.
2017-08-08 15:40:11 +04:00
Alexey Botchkov
01a4eb8f76 MDEV-12732 json.json_no_table fails with valgrind in buildbot and
outside.

        The result_limit variable wasn't always initialized in
        Item_func_json_array::fix_length_and_dec().
2017-08-08 13:49:29 +04:00
Alexey Botchkov
bb71d9abf2 MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
Comparison fixed to take the actual type of JSON value into
        account. Bug in escaping handling fixed.
2017-08-08 10:35:26 +04:00
Alexander Barkov
a8caa8e04a MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions 2017-05-20 16:29:11 +04:00
Monty
1e04ad284c Fixed compiler warnings and warnings from build.tags
Other things
- Ensure that ut_d() is set to EXPR if ut_ad() is DEBUG_ASSERT()
  If not, we will get a crash in purge_sys_t::~purge_sys_t() as
  this ut_ad() code expect's that the ut_d() codes has been executed
2017-05-08 02:33:35 +03:00
Alexey Botchkov
3ea9d3e59e MDEV-12363 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*).
maybe_null wasn't properly set for Item_json_func_keys.
2017-05-02 15:47:43 +04:00
Alexey Botchkov
42ad4f2821 MDEV-12364 Server crashes in __memcpy_sse2_unaligned / String::copy on
JSON_SEARCH with variables.

        Wrong index for the tmp_paths array in
        Item_func_json_search::val_str.
2017-05-02 14:28:57 +04:00
Alexey Botchkov
76f6c1e1ed MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on
JSON_REMOVE.

        null_value wasn't properly set in Item_json_func_remove::val_str.
2017-03-20 15:18:06 +04:00
Alexey Botchkov
af6eee1fc5 MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
Now let's check JSON length to fit the max_allowed packet.
2017-03-14 17:31:14 +04:00
Alexey Botchkov
7c7c0696e7 MDEV-11856 json_search doesn't search for values with double quotes
character (").

        The my_wildcmp function doesn't expect the string parameter to
        have escapements, only the template. So the string
        should be unescaped if necessary.
2017-03-14 15:25:02 +04:00
Sergei Golubchik
6f6d0531dc MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to work
Use JSON_COMPACT(X) instead of CAST(X AS JSON).
Bonus - X is validated to be a valid JSON.
Fix a typo in the error message.
2017-02-14 20:43:41 +01:00
Sergei Golubchik
e0fa2ce40f bugfix: uninitialized variable
fixes crashes on win32-debug
2017-02-14 20:43:41 +01:00
Alexey Botchkov
f76d5fefb8 MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to
work.

        json_detailed() fixed
2017-02-14 17:51:03 +04:00
Alexey Botchkov
25aaecb240 MDEV-11858 json_merge() concatenates instead of merging.
Fix json_merge implementation.
2017-02-10 01:05:27 +04:00
Alexey Botchkov
0e6968c244 MDEV-11857 json_search() shows "Out of memory" with empty key.
We should be ready for an empty key.
2017-02-09 17:38:53 +04:00
Alexey Botchkov
abf7582112 MDEV-11557 port MySQL-5.7 JSON tests to MariaDB.
Fixes for issues found.
2017-02-06 06:47:48 +04:00
Alexey Botchkov
d123ed852a MDEV-11938 json.json_no_table crashes or fails with valgrind warnings in json_find_path / Item_func_json_length::val_int.
Paths with quoted keynames handled improperly.
2017-02-02 18:56:15 +04:00
Alexey Botchkov
d96ee168a1 MDEV-11557 port MySQL-5.7 JSON tests to MariaDB.
paths ending on [0]..[0] should be handled in conforming manner.
2017-01-26 16:35:05 +04:00
Alexey Botchkov
35760c0000 MDEV-11557 Port MySQL-5.7 JSON tests to MariaDB.
more fixes.
2017-01-25 00:13:15 +04:00
Alexey Botchkov
50831b0f19 MDEV-11557 port MySQL-5.7 JSON tests to MariaDB.
json_no_table.test ported.
2017-01-24 17:34:44 +04:00
Alexey Botchkov
0d107a85b3 MDEV-11042 Implement GeoJSON functions.
ST_AsGeoJSON and ST_GeomFromGeoJSON functions implemented.
2017-01-24 02:29:04 +04:00
Monty
1628a2ae27 Fixed issues found by buildbot
- MDEV-11621 rpl.rpl_gtid_stop_start fails sporadically in buildbot
- MDEV-11620 rpl.rpl_upgrade_master_info fails sporadically in buildbot

The issue above was probably that the build machine was overworked and the
shutdown took longer than 30 resp 10 seconds, which caused MyISAM tables
to be marked as crashed.
Fixed by flushing myisam tables before doing a forced shutdown/kill.
I also increased timeout for forced shutdown from 10 seconds to 60 seconds
to fix other possible issues on slow machines.

Fixed also some compiler warnings
2017-01-11 09:18:35 +02:00
Alexey Botchkov
3a1772798d MDEV-11573 JSON_LENGTH returns incorrect results.
Item_func_json_length fixed.
2016-12-24 11:40:31 +04:00
Alexey Botchkov
95228dc80b MDEV-11570 JSON_MERGE returns incorrect result.
JSON merging fixed.
2016-12-20 17:32:08 +04:00
Alexey Botchkov
ce55094f4f MDEV-11572 JSON_DEPTH returns wrong results.
JSON depth calculation fixed.
2016-12-16 14:06:12 +04:00
Alexey Botchkov
30c231b03a MDEV-11569 JSON_ARRAY_INSERT produces an invalid result.
String insertion fixed.
2016-12-16 13:51:35 +04:00
Alexey Botchkov
beded4350f MDEV-JSON_CONTAINS_PATH returns incorrect results and produces wrong warning.
The Item_func_json_contains_path was mistakenly set with the
        no '*' paths limitation.
2016-12-16 12:43:44 +04:00
Alexey Botchkov
e5377be211 MDEV-11562 Assertion `js->state == JST_VALUE' failed in check_contains(json_engine_t*, json_engine_t*).
check_contains() fixed. When an item of an array is a complex
        structure, it can be half-read after the end of the recursive
        check_contains() call. So we just manually get to it's ending.
2016-12-16 12:32:56 +04:00
Alexey Botchkov
d26b9f670d MDEV-11470 JSON_KEYS accepts arguments in invalid format.
Now JSON functions return warnings if arguments are invalid.
2016-12-13 12:39:48 +04:00
Alexey Botchkov
9320d8ae30 MDEV-11453 JSON_CONTAINS returns incorrect values.
The weird logic of json_contains was implemented.
2016-12-11 01:12:33 +04:00
Alexey Botchkov
04aa31c70b MDEV-11469 JSON_SEARCH returns incorrect results.
Support for '**' in json path expressions added.
2016-12-09 12:26:32 +04:00
Alexey Botchkov
7f6710e5be MDEV-11489 Assertion `0' failed in json_find_path.
When the json was just a scalar value, json_extract tried
        to parse after the value ended.
2016-12-08 11:25:21 +04:00
Alexey Botchkov
3bae5328ea MDEV-11433 JSON_MERGE returns a non-NULL result with a NULL argument.
Item_func_json_merge fixed.
2016-12-06 01:32:13 +04:00
Alexey Botchkov
3743b4c3ef MDEV-11468 JSON_UNQUOTE returns incorrect results.
Now return the argument's value when error.
2016-12-06 00:34:25 +04:00
Alexey Botchkov
1da0865058 MDEV-11467 JSON_EXTRACT returns incorrect results.
Item_func_json_extract::val_str fixed.
2016-12-05 09:34:28 +04:00
Alexey Botchkov
2b01461629 MDEV-11465 JSON_LENGTH returns incorrect length.
Item_func_json_length::val_int fixed.
2016-12-05 08:59:55 +04:00
Alexey Botchkov
fe6d0a0719 MDEV-11471 JSON_ARRAY_APPEND returns incorrect results.
Item_func_json_array_append::val_str fixed.
2016-12-05 08:43:15 +04:00
Alexey Botchkov
abb80d25f4 MDEV-11472 JSON_ARRAY_INSERT returns incorrect results.
Item_func_json_array_insert::val_str fixed.
2016-12-05 08:03:11 +04:00
Alexey Botchkov
df87dce03c MDEV-11473 JSON_REMOVE returns invalid results.
Item_func_json_remove::val_str fixed.
2016-12-05 07:42:00 +04:00
Alexey Botchkov
7e03c67ae8 MDEV-11474 JSON_DEPTH returns incorrect results.
Item_func_json_depth::val_int fixed.
2016-12-05 07:17:54 +04:00
Alexey Botchkov
78dc7c3a6e MDEV-11461 JSON_TYPE does not recognize integer/double types.
Integer/Double recognition added.
2016-12-05 01:03:31 +04:00
Alexey Botchkov
12897a5bba MDEV-11437 JSON_QUOTE function does not quote and uses wrong character set.
json_quote fixed.
2016-12-05 01:03:30 +04:00
Alexey Botchkov
b4cbaf0b7c MDEV-11436 CREATE TABLE .. AS SELECT JSON_OBJECT truncates data.
fix_length_and_dec() didn't calculate the length of the result
        properly.
2016-12-05 01:03:30 +04:00
Alexey Botchkov
edc75c9c16 MDEV-11450 Assertion `!null_value' failed invirtual bool Item::send on json_search.
Item_func_json_search::val_str didn't set the null_value
        properly. So that affected the next record in the resultset.
2016-12-03 12:11:06 +04:00
Alexey Botchkov
a8467e2fab MDEV-11449 Server crashes in Item_func_or_sum::agg_item_collations.
JSON_ARRAY didn't expect 0 arguments.
2016-12-03 11:45:24 +04:00
Alexey Botchkov
eca1579051 MDEV-11444 Server crashes in String::ptr / Item_func_json_depth::val_int.
CAST AS JSON didn't set the null_value mark properly.
2016-12-03 11:32:47 +04:00
Alexey Botchkov
4ad0813a55 MDEV-11143 Server crashes in json_string_set_cs.
Some JSON functions didn't expect NULL as a path.
2016-12-03 11:22:42 +04:00
Alexey Botchkov
e8c419570f MDEV-11442 Server crashes in String::length / parse_one_or_all /Item_func_json_contains_path::val_int
Didn't expect 'one_or_all' parameter to be NULL.
2016-12-03 11:02:28 +04:00
Alexey Botchkov
b28626e842 MDEV-11441 Server crashes in String::append /Item_func_json_extract::val_str.
Wrong 'value_lengh' taken
2016-12-03 10:53:12 +04:00
Alexey Botchkov
0d85124da4 func_json.test failing on Windows fixed. 2016-11-16 12:47:46 +04:00
Alexey Botchkov
ebe5ebba16 MDEV-9143 JSON_xxx functions.
The rest of mysql/json functions implemented.
        CAST AS JSON implemented.
2016-11-15 17:04:31 +04:00
Alexey Botchkov
27025221fe MDEV-9143 JSON_xxx functions.
strings/json_lib.c added as a JSON library.
        SQL frunction added with sql/item_jsonfunc.h/cc
2016-10-19 14:10:03 +04:00