Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7665

Bug in biblio3.json JSON example file in manual

    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

            Hide
            elenst Elena Stepanova added a comment -

            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.

            Show
            elenst Elena Stepanova added a comment - 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.
            Hide
            ccalender Chris Calender added a comment -

            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.

            Show
            ccalender Chris Calender added a comment - 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.
            Hide
            greenman Ian Gilfillan added a comment -

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

            Show
            greenman Ian Gilfillan added a comment - Thanks, the missing bracket has been added to the docs.

              People

              • Assignee:
                greenman Ian Gilfillan
                Reporter:
                ccalender Chris Calender
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: