Details
-
Bug
-
Status: Closed (View Workflow)
-
Trivial
-
Resolution: Fixed
-
N/A
Description
https://mariadb.com/kb/en/mariadb/connect-json-table-type/
biblio3.json has an error - it is missing a
{ at the end, before last ]. If you use it as-is, the CREATE TABLE works, but the first SELECT fails: {code:sql}mysql> create table jsample (
-> ISBN char(15),
-> LANG char(2),
-> SUBJECT char(32),
-> AUTHOR char(128),
-> TITLE char(32),
-> TRANSLATED char(80),
-> PUBLISHER char(20),
-> DATEPUB int(4))
-> engine=CONNECT table_type=JSON
-> File_name='biblio3.json';
Query OK, 0 rows affected (0.01 sec)
mysql> select isbn, author, title, publisher from jsample;
ERROR 1296 (HY000): Got error 174 'Unexpected character ']' near }' from CONNECT
|
Fix the error in biblio3.json (add a "{" at the end just before the last "]"), and re-run, and now it works:
|
|
{code:sql}
|
mysql> drop table jsample;
|
Query OK, 0 rows affected (0.13 sec)
|
|
mysql> create table jsample (
|
-> ISBN char(15),
|
-> LANG char(2),
|
-> SUBJECT char(32),
|
-> AUTHOR char(128),
|
-> TITLE char(32),
|
-> TRANSLATED char(80),
|
-> PUBLISHER char(20),
|
-> DATEPUB int(4))
|
-> engine=CONNECT table_type=JSON
|
-> File_name='biblio3.json';
|
Query OK, 0 rows affected (0.01 sec)
|
|
mysql> select isbn, author, title, publisher from jsample;
|
+---------------+--------------------------+--------------------------------+----------------+
|
| isbn | author | title | publisher |
|
+---------------+--------------------------+--------------------------------+----------------+
|
| 9782212090819 | Jean-Christophe Bernadac | Construire une application XML | Eyrolles Paris |
|
| 9782840825685 | William J. Pardi | XML en Action | |
|
+---------------+--------------------------+--------------------------------+----------------+
|
2 rows in set (0.01 sec)
|