[MDEV-7665] Bug in biblio3.json JSON example file in manual Created: 2015-03-05  Updated: 2015-03-09  Resolved: 2015-03-09

Status: Closed
Project: MariaDB Server
Component/s: Documentation
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Trivial
Reporter: Chris Calender (Inactive) Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: verified


 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)



 Comments   
Comment by Elena Stepanova [ 2015-03-05 ]

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-7666 for further discussion.

Comment by Chris Calender (Inactive) [ 2015-03-05 ]

Yes, you are correct! I tested this and now get the same results the manual shows, so that is great.

The warning(s) can be ignored.

Comment by Ian Gilfillan [ 2015-03-09 ]

Thanks, the missing bracket has been added to the docs.

Generated at Thu Feb 08 07:21:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.