-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible syntax mismatch for json_object in MySQL compatibility mode #3575
Comments
If MySQL doesn't accept them, please ask developers of MySQL about support of standard syntax. |
You can submit a PR, of course, but this non-portable syntax should only be allowed in MySQL (and possibly MariaDB, if this DBMS allows it too) compatibility modes. It must be rejected in all other modes to avoid its accidental misuse. |
It seems, that rule of thumb here is: we are trying not to implement compatibility for bugs and deficiencies of other databases. |
Sorry, I thought that MySQL compatibility mode was meant to adapt mismatching features between a specif DB engine and H2. |
You may submit a pull request where
But please find existing or fill new issues in their bugtrackers about missing support for standard syntax and post links to these issues here. It will be even better to contribute support of standard-compliant |
Non-standard syntax reported for MariaDB project |
FYI: The guys at MariaDB accepted the claim on the colon ':' separator syntax 🎉
|
I answered to your question here: |
Hello,
I'm using H2 for integration tests on a daily basis, and I think I found a syntax mismatch in MySQL compatibility mode (MODE=MySQL) for the
json_object
function.MySQL version: 5.7 and 8.0
H2 version: 2.1.210 and 2.1.214
Exemple 1:
select json_object('first_name', 'John', 'last_name', 'Doe');
MySQL Result:
{"last_name": "Doe", "first_name": "John"}
H2 Result: not works (Syntax error in SQL statement)
Exemple 2:
select json_object('first_name': 'John', 'last_name': 'Doe');
MySQL Result: not works (bad SQL grammar)
H2 Result:
{"first_name":"John","last_name":"Doe"}
Exemple 3:
select json_object(key 'first_name' value 'John', key 'last_name' value 'Doe');
MySQL Result: not works (bad SQL grammar)
H2 Result:
{"first_name":"John","last_name":"Doe"}
https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html#function_json-object
Is it possible (or is it intended to) to have a compatible
json_object
syntaxe for MySQL compatibility mode?The text was updated successfully, but these errors were encountered: