Giter Site home page Giter Site logo

Comments (3)

tianx avatar tianx commented on April 28, 2024

Hi @joanney1,

Thanks for using the document feature!

I tried your test case but couldn't reproduce the problem you had. The query works fine for me. Please feel free to let us know if you have additional questions.

mysql> select id, doc.name from tt where doc.address.zipcode like '98761';
+-----+--------------+
| id  | `doc`.`name` |
+-----+--------------+
| 100 | Tom          |
+-----+--------------+
1 row in set (0.00 sec)

mysql> select * from tt;
+-----+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id  | doc                                                                                                                                                           |
+-----+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 100 | {"name":"Tom","age":30,"married":false,"address":{"houseNumber":1001,"streetName":"main","zipcode":"98761","state":"CA"},"cars":["F150","Honda"],"memo":null} |
+-----+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select doc.name from tt;
+--------------+
| `doc`.`name` |
+--------------+
| Tom          |
+--------------+
1 row in set (0.00 sec)

mysql> select doc.address.zipcode from tt;
+---------------------------+
| `doc`.`address`.`zipcode` |
+---------------------------+
| 98761                     |
+---------------------------+
1 row in set (0.00 sec)

from mysql-5.6.

joanney1 avatar joanney1 commented on April 28, 2024

My Test is very simple

Download current zip file.
unzip source file.
cmake without options
make
make install
./scripts/mysql_install_db
./bin/mysqld_safe --user=mysql

Connecting mysql client tool.

mysql> show variables like '%doc%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| allow_document_type | ON |
+---------------------+-------+
1 row in set (0.00 sec)

mysql> use test;
Database changed
mysql> create table t( id int not null, doc document not null, primary key (id), unique key id_doc (id, doc.address.zipcode as int))engine=innodb;
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t values ( 1, '{"name":"tom","age":30}');
Query OK, 1 row affected (0.00 sec)

mysql> select doc.name from t;
+--------------+
| doc.name |
+--------------+
| NULL |
+--------------+
1 row in set (0.00 sec)

Did I compile something wrong?
Did I install mysql something wrong?
And
Did I change system variables's value something wrong?

I don't know what I did something wrong.

from mysql-5.6.

tianx avatar tianx commented on April 28, 2024

Hi @joanney1,

Sorry for the delay in replying. I am not clear why you hit this problem. I tried the same queries and still couldn't reproduce - all queries work for me.

We have many more test cases using document paths including some queries similar to yours, covered in our test file: http://github.com/facebook/mysql-5.6/blob/webscalesql-5.6.24.97/mysql-test/suite/json/t/type_document_path.test. Please take a look at the test file and try to run our test cases to see they work for you.

from mysql-5.6.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.