Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL)
-
Arch Linux
Linux kernel 4.4.23-1-lts
Lenovo ThinkPad E540
Description
I try to use User Defined Function lib_mysqludf_json from https://github.com/mysqludf/lib_mysqludf_json with MariaDB 10.1.18 and found an incorrect behavior of UDF_ARGS attribute_lengths.
typedef struct st_udf_args
|
{
|
...
|
unsigned long *attribute_lengths; /* Length of attribute arguments */
|
...
|
} UDF_ARGS;
|
Example:
When you use SELECT json_object("citizen_id") FROM ...
you will have:
args->attributes[0] = "citizen_id"
|
args->attribute_lengths[0] = 12
|
That's correct.
When you use SELECT json_object(citizen_id AS citizen_id) FROM ...
args->attributes[0] = citizen_id
|
args->attribute_lengths[0] = 10
|
That's also correct.
But when you use SELECT json_object(citizen_id) FROM ...
args->attributes[0] = citizen_id
|
args->attribute_lengths[0] = 0
|
That's incorrect. Correct value of attribute_lengths[0] is 10.
That's not reproducable on MySQL. This is not lib_mysqludf_json incorrect behavior, it just uses standart struct UDF_ARGS.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
I try to use User Defined Function lib_mysqludf_json from https://github.com/mysqludf/lib_mysqludf_json with MariaDB 10.1.18 and found an incorrect behavior of UDF_ARGS attribute_lengths.
typedef struct st_udf_args { ... unsigned long *attribute_lengths; /* Length of attribute arguments */ ... } UDF_ARGS; Example: When you use SELECT json_object("citizen_id") FROM ... you will have: args->attributes[0] = "citizen_id" args->attribute_lengths[0] = 12 That's correct. When you use SELECT json_object(citizen_id AS citizen_id) FROM ... args->attributes[0] = citizen_id args->attribute_lengths[0] = 10 That's also correct. But when you use SELECT json_object(citizen_id) FROM ... args->attributes[0] = citizen_id args->attribute_lengths[0] = 0 That's incorrect. Correct value of attribute_lengths[0] is 10. That's not reproducable on MySQL. This is not lib_mysqludf_json incorrect behavior, it just uses standart struct UDF_ARGS. |
I try to use User Defined Function lib_mysqludf_json from https://github.com/mysqludf/lib_mysqludf_json with MariaDB 10.1.18 and found an incorrect behavior of UDF_ARGS attribute_lengths.
{noformat} typedef struct st_udf_args { ... unsigned long *attribute_lengths; /* Length of attribute arguments */ ... } UDF_ARGS; {noformat} Example: When you use SELECT json_object("citizen_id") FROM ... you will have: {noformat} args->attributes[0] = "citizen_id" args->attribute_lengths[0] = 12 {noformat} That's correct. When you use SELECT json_object(citizen_id AS citizen_id) FROM ... {noformat} args->attributes[0] = citizen_id args->attribute_lengths[0] = 10 {noformat} That's also correct. But when you use SELECT json_object(citizen_id) FROM ... {noformat} args->attributes[0] = citizen_id args->attribute_lengths[0] = 0 {noformat} That's incorrect. Correct value of attribute_lengths[0] is 10. That's not reproducable on MySQL. This is not lib_mysqludf_json incorrect behavior, it just uses standart struct UDF_ARGS. |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 5.5 [ 15800 ] | |
Affects Version/s | 10.0 [ 16000 ] | |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.1.18 [ 22110 ] | |
Assignee | Alexey Botchkov [ holyfoot ] | |
Labels | upstream-fixed |
Fix Version/s | 5.5 [ 15800 ] | |
Fix Version/s | 10.0 [ 16000 ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
issue.field.resolutiondate | 2017-07-18 09:44:09.0 | 2017-07-18 09:44:09.941 |
Fix Version/s | 5.5.58 [ 22540 ] | |
Fix Version/s | 5.5 [ 15800 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 78170 ] | MariaDB v4 [ 151167 ] |
Thanks for the report.
Same in MySQL 5.5, but not reproducible with MySQL 5.6.
MariaDB 10.1.19
MySQL 5.6
| json_object(citizen_id) |
Both MySQL 5.7 and MariaDB 10.2 have native JSON_OBJECT, so it's not applicable there.