Commit 8f668196 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix column types wrongly set to TYPE_STRING in JSONColumns

when the column contains NULL values.
  modified:   storage/connect/tabjson.cpp

MDEV-12651: change error code to ER_ILLEGAL_HA in rnd_pos.
  modified:   storage/connect/ha_connect.cc
parent ea7081bf
...@@ -4009,7 +4009,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos) ...@@ -4009,7 +4009,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
} else { } else {
PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp); PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp);
strcpy(g->Message, "Not supported by this table type"); strcpy(g->Message, "Not supported by this table type");
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); my_message(ER_ILLEGAL_HA, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR; rc= HA_ERR_INTERNAL_ERROR;
} // endif SetRecpos } // endif SetRecpos
......
...@@ -288,8 +288,13 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info) ...@@ -288,8 +288,13 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info)
break; break;
if (jcp) { if (jcp) {
if (jcp->Type != jcol.Type) if (jcp->Type != jcol.Type) {
jcp->Type = TYPE_STRING; if (jcp->Type == TYPE_UNKNOWN)
jcp->Type = jcol.Type;
else if (jcol.Type != TYPE_UNKNOWN)
jcp->Type = TYPE_STRING;
} // endif Type
if (*fmt && (!jcp->Fmt || strlen(jcp->Fmt) < strlen(fmt))) { if (*fmt && (!jcp->Fmt || strlen(jcp->Fmt) < strlen(fmt))) {
jcp->Fmt = PlugDup(g, fmt); jcp->Fmt = PlugDup(g, fmt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment