On 03.02.15 13:13, Sergei Golubchik wrote: [skip]
A dynamic column cannot be NULL, so using a JSON null (a different kind of null) to express "dynamic column exists but cannot be represented as requested" should work. The ORM would then have the names and positions in the structure of all the BINARY dynamic columns. With that it can send a SELECT with one or more COLUMN_GET(dyncol_blob, "name" AS BINARY) expressions. I could live with that. Hmm. May be a dynamic column cannot be NULL now, but this is not a conceptual limitation, there is no logical reason why it coldn't be. So I'd rather keep JSON null for that. What I mean was that the whole COLUMN_GET should fail and return NULL, just as any function does when it gets invalid input:
MariaDB [test]> select uncompress("foobar"), 1/0, sqrt(-2); +----------------------+------+----------+ | uncompress("foobar") | 1/0 | sqrt(-2) | +----------------------+------+----------+ | NULL | NULL | NULL | +----------------------+------+----------+
(it can also throw a warning, like uncompress does).
Logic under dynamic column NULL is following - do not store NULL data. So actually any unknown field is NULL and dynamic column function accept NULL as value and even return NULL. The problem is that for JSON the field will not be listed then. [skip]