1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-25151 JSON_TABLE: Unexpectedly padded values in a PATH column.

Field length can increase after the change_charset(), so need to
set field->ptr properly.

also sensitive parts of the test moved to json_not_embedded.test.
This commit is contained in:
Alexey Botchkov
2021-03-18 15:36:28 +04:00
parent 047eb2258d
commit 51ac57fbbe
5 changed files with 90 additions and 51 deletions

View File

@@ -98,26 +98,6 @@ a
1
connection default;
disconnect con1;
create database db;
use db;
create table t (a text);
insert into t values ('{"foo":"bar"}');
create user u@localhost;
grant select (a) on db.t to u@localhost;
connect con1,localhost,u,,db;
select a from t;
a
{"foo":"bar"}
select * from t, json_table(t.a, '$' columns(f varchar(20) path '$.foo')) as jt;
a f
{"foo":"bar"} bar
select * into outfile 'f' from json_table('[]', '$' columns(x for ordinality)) q;
ERROR 28000: Access denied for user 'u'@'localhost' (using password: NO)
connection default;
disconnect con1;
drop user u@localhost;
drop database db;
use test;
create table t1 (
color varchar(32),
price int
@@ -515,5 +495,15 @@ a
SELECT a, b FROM JSON_TABLE('[]', '$' COLUMNS (a FOR ORDINALITY, b INT PATH '$[*]' ERROR ON EMPTY)) AS t ORDER BY a;
ERROR HY000: Field 'b' can't be set for JSON_TABLE 't'.
#
# MDEV-25151 JSON_TABLE: Unexpectedly padded values in a PATH column.
#
SET @old_character_set_connection= @@character_set_connection;
SET @@character_set_connection= utf8;
select hex(a), b from json_table('["foo","bar"]','$[*]' columns (a char(3) path '$', b for ordinality)) t;
hex(a) b
666F6F 1
626172 2
SET @@character_set_connection= @old_character_set_connection;
#
# End of 10.6 tests
#