You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
fix(MCOL-5842): Fix JSON_OBJECT's handling of empty strings
JSON_OBJECT() (and probably some other JSON functions) now properly handle empty strings in their arguments - JSON_OBJECT used to return NULL, now it returns empty string.
This commit is contained in:
committed by
Leonid Fedorov
parent
b6707dd9f8
commit
e37d621a12
@ -0,0 +1,12 @@
|
|||||||
|
DROP DATABASE IF EXISTS MCOL5842;
|
||||||
|
CREATE DATABASE MCOL5842;
|
||||||
|
USE MCOL5842;
|
||||||
|
CREATE TABLE tcs(t TEXT) ENGINE=Columnstore;
|
||||||
|
INSERT INTO tcs(t) VALUES ('');
|
||||||
|
SELECT JSON_OBJECT('t', t, 'a', 'b') FROM tcs;
|
||||||
|
JSON_OBJECT('t', t, 'a', 'b')
|
||||||
|
{"t": "", "a": "b"}
|
||||||
|
SELECT GROUP_CONCAT(JSON_OBJECT('t', t, 'a', 'b')) FROM tcs;
|
||||||
|
GROUP_CONCAT(JSON_OBJECT('t', t, 'a', 'b'))
|
||||||
|
{"t": "", "a": "b"}
|
||||||
|
DROP DATABASE MCOL5842;
|
@ -0,0 +1,12 @@
|
|||||||
|
--disable_warnings
|
||||||
|
DROP DATABASE IF EXISTS MCOL5842;
|
||||||
|
--enable_warnings
|
||||||
|
CREATE DATABASE MCOL5842;
|
||||||
|
USE MCOL5842;
|
||||||
|
|
||||||
|
CREATE TABLE tcs(t TEXT) ENGINE=Columnstore;
|
||||||
|
INSERT INTO tcs(t) VALUES ('');
|
||||||
|
SELECT JSON_OBJECT('t', t, 'a', 'b') FROM tcs;
|
||||||
|
SELECT GROUP_CONCAT(JSON_OBJECT('t', t, 'a', 'b')) FROM tcs;
|
||||||
|
|
||||||
|
DROP DATABASE MCOL5842;
|
@ -32,7 +32,7 @@ bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullSt
|
|||||||
int strLen = jsLen * 12 * jsCS->mbmaxlen / jsCS->mbminlen;
|
int strLen = jsLen * 12 * jsCS->mbmaxlen / jsCS->mbminlen;
|
||||||
char* buf = (char*)alloca(strLen);
|
char* buf = (char*)alloca(strLen);
|
||||||
if ((strLen = json_escape(retCS, (const uchar*)rawJS, (const uchar*)rawJS + jsLen, jsCS, (uchar*)buf,
|
if ((strLen = json_escape(retCS, (const uchar*)rawJS, (const uchar*)rawJS + jsLen, jsCS, (uchar*)buf,
|
||||||
(uchar*)buf + strLen)) > 0)
|
(uchar*)buf + strLen)) >= 0)
|
||||||
{
|
{
|
||||||
buf[strLen] = '\0';
|
buf[strLen] = '\0';
|
||||||
ret.append(buf, strLen);
|
ret.append(buf, strLen);
|
||||||
|
Reference in New Issue
Block a user