Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: N/A
-
Fix Version/s: N/A
-
Component/s: Documentation
-
Labels:
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:
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:
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)
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Only I think the bracket is missing in a different place:
elenst@wheezy-64:~/git/10.0$ diff -u biblio3.json.old biblio3.json --- biblio3.json.old 2015-03-05 20:48:17.000000000 +0300 +++ biblio3.json 2015-03-05 20:48:38.000000000 +0300 @@ -36,6 +36,7 @@ "TRANSLATOR": { "FIRSTNAME": "James", "LASTNAME": "Guerin" + } }, "PUBLISHER": { "NAME": "Microsoft Press",See also
MDEV-7666for further discussion.