Bug #92416 mysqlx (X DevAPI) does not allow "(@)" (@ inside parenthesis) as value

Submitted: 14 Sep 2018 4:18 Modified: 10 May 2022 21:32
Reporter: Jesper wisborg Krogh Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[14 Sep 2018 4:18] Jesper wisborg Krogh
Description:
If you have a value in a JSON document that includes an @ inside parenthesis, it is not possible to add the document to a collection:

Traceback (most recent call last):
  File "test.py", line 15, in <module>
    mycol.add({"A": "(@)"}).execute()
  File "/usr/lib64/python2.7/site-packages/mysqlx/statement.py", line 583, in execute
  File "/usr/lib64/python2.7/site-packages/mysqlx/connection.py", line 243, in wrapper
  File "/usr/lib64/python2.7/site-packages/mysqlx/connection.py", line 505, in send_insert
  File "/usr/lib64/python2.7/site-packages/mysqlx/protocol.py", line 514, in send_insert
  File "/usr/lib64/python2.7/site-packages/mysqlx/expr.py", line 296, in build_expr
  File "/usr/lib64/python2.7/site-packages/mysqlx/expr.py", line 329, in build_object
  File "/usr/lib64/python2.7/site-packages/mysqlx/expr.py", line 335, in build_object
  File "/usr/lib64/python2.7/site-packages/mysqlx/expr.py", line 303, in build_expr
  File "/usr/lib64/python2.7/site-packages/mysqlx/expr.py", line 424, in __init__
  File "/usr/lib64/python2.7/site-packages/mysqlx/expr.py", line 614, in lex
ValueError: Unknown character at 1

How to repeat:
import mysqlx

connect_args = {
    "user": "root",
    "password": "password",
    "host": "127.0.0.1",
    "port": 33060,
}

db = mysqlx.get_session(**connect_args)

schema = db.create_schema("db1")
mycol = schema.create_collection("mycol")
mycol.add({"A": "(@)"}).execute()

db.close()
[5 Dec 2018 23:21] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/Python 8.0.14 release, and here's the changelog entry:

The connector assumed that all values were expressions, which could lead
to errors. The expr() method is now required to designate values as
expressions.

Thank you for the bug report.
[10 May 2022 21:32] Philip Olson
Status->Closed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.