← Back to team overview

maria-discuss team mailing list archive

Re: JSON and binary strings

 

I could have been more direct. What should be the expected behavior in the
following?

SELECT COLUMN_JSON(COLUMN_CREATE('name', UNHEX('C1C2C3C4C5C6')));


From:  Tom Worster <fsb@xxxxxxxxxx>
Date:  Friday, January 30, 2015 at 9:05 PM
To:  maria-discuss email list <maria-discuss@xxxxxxxxxxxxxxxxxxx>
Subject:  [Maria-discuss] JSON and binary strings

BINARY is one of the datatypes you can use with dynamic columns. If you try
saving binary string and then retrieve it with COLUMN_JSON() then you get an
invalid JSON document back. All the JSON decoders I tested reject such
documents.

It doesn't make sense to me that COLUMN_JSON() would return a document
that's invalid according to the JSON spec and can't be decoded. But I don't
know what it should do. It seems that BINARY in dynamic columns means that
COLUMN_JSON() is in an impossible position.

[On a related note, if you save a valid utf8 string that includes control
characters (e.g. "I went down to the river,\nI set down on the bank.") then
COLUMN_JSON() fails to escape them. While similar, this I think is a bug.]

Tom
_______________________________________________ Mailing list:
https://launchpad.net/~maria-discuss Post to     :
maria-discuss@xxxxxxxxxxxxxxxxxxx Unsubscribe :
https://launchpad.net/~maria-discuss More help   :
https://help.launchpad.net/ListHelp


Follow ups