[MDEV-7666] Another potential bug in biblio3.json JSON example file in manual Created: 2015-03-05  Updated: 2015-03-06  Due: 2015-03-26  Resolved: 2015-03-06

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

Type: Bug Priority: Trivial
Reporter: Chris Calender (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None


 Description   

On this page:

https://mariadb.com/kb/en/mariadb/connect-json-table-type/

Even after fixing the biblio3.json file (as described in https://mariadb.atlassian.net/browse/MDEV-7665), examples #2 and #3 have an issue with both 10.0.16 and 10.0.17.

Both CREATE TABLE commands run fine.

However, both SELECT statements return slightly different results because there are 2 warnings:

=============
= Example #2: =
=============

mysql> create table jsampall (
    -> ISBN char(15),
    -> Language char(2) field_format='LANG',
    -> Subject char(32) field_format='SUBJECT',
    -> Author char(128) field_format='AUTHOR:[" and "]',
    -> Title char(32) field_format='TITLE',
    -> Translation char(32) field_format='TRANSLATOR :PREFIX',
    -> Translator char(80) field_format='TRANSLATOR',
    -> Publisher char(20) field_format='PUBLISHER:NAME',
    -> Location char(16) field_format='PUBLISHER:PLACE',
    -> Year int(4) field_format='DATEPUB')
    -> engine=CONNECT table_type=JSON File_name='biblio3.json';
Query OK, 0 rows affected (0.01 sec)

mysql> select title, author, publisher, location from jsampall;
+--------------------------------+-----------------------------------+-----------+----------+
| title                          | author                            | publisher | location |
+--------------------------------+-----------------------------------+-----------+----------+
| Construire une application XML | Jean-Christophe Bernadac and Fran | Eyrolles  | Paris    |
| XML en Action                  | William J. Pardi                  |           |          |
+--------------------------------+-----------------------------------+-----------+----------+
2 rows in set, 2 warnings (0.00 sec)
 
mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                    |
+---------+------+--------------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect string value: '\xE7ois K...' for column 'Author' at row 1                        |
| Warning | 1105 | Out of range value Jean-Christophe Bernadac and Frantois Knab for column 'Author' at row 1  |
+---------+------+--------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

=============
= Example #3: =
=============

Here, the SELECT actually needs inferred as it is omitted (that needs added too, so please use the SELECT from below to update the manual).

mysql> create table jsampex (
    -> ISBN char(15),
    -> Title char(32) field_format='TITLE',
    -> AuthorFN char(128) field_format='AUTHOR:[X]:FIRSTNAME',
    -> AuthorLN char(128) field_format='AUTHOR:[X]:LASTNAME',
    -> Year int(4) field_format='DATEPUB')
    -> engine=CONNECT table_type=JSON File_name='biblio3.json';
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT ISBN, Title, AuthorFN, AuthorLN, Year FROM jsampex;
+---------------+--------------------------------+-----------------+----------+------+
| ISBN          | Title                          | AuthorFN        | AuthorLN | Year |
+---------------+--------------------------------+-----------------+----------+------+
| 9782212090819 | Construire une application XML | Jean-Christophe | Bernadac | 1999 |
| 9782212090819 | Construire une application XML | Fran            | Knab     | 1999 |
| 9782840825685 | XML en Action                  | William J.      | Pardi    |    0 |
+---------------+--------------------------------+-----------------+----------+------+
3 rows in set, 2 warnings (0.00 sec)
 
mysql> show warnings;
+---------+------+------------------------------------------------------------------+
| Level   | Code | Message                                                          |
+---------+------+------------------------------------------------------------------+
| Warning | 1366 | Incorrect string value: '\xE7ois' for column 'AuthorFN' at row 2 |
| Warning | 1105 | Out of range value Frantois for column 'AuthorFN' at row 2        |
+---------+------+------------------------------------------------------------------+
2 rows in set (0.00 sec)

Both report "Incorrect string value: '\xE7ois..." so I suspect the cause is the same in each case.

But this needs fixed.



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

Can it be that 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",

This way results seem correct.

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 Elena Stepanova [ 2015-03-06 ]

Then I'm keeping MDEV-7665 and closing this one.

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