Skip to content
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

Parsing "@@" throws exception #1237

Closed
Aceto1 opened this issue Jun 22, 2021 · 1 comment · Fixed by #1676
Closed

Parsing "@@" throws exception #1237

Aceto1 opened this issue Jun 22, 2021 · 1 comment · Fixed by #1676

Comments

@Aceto1
Copy link

Aceto1 commented Jun 22, 2021

Describe the bug
When parsing the below SQL an exception with the message: "Not yet supprted" is thrown. This is totally valid MariaDB SQL Syntax that runs just fine when directly executing on the database.

To Reproduce
Steps to reproduce the behavior:

  1. SQL: "SET @@global.time_zone = '01:00'"
  2. Parsing this SQL using JSqlParser with this statements
  3. Exception:
Encountered unexpected token: "@@" "@@"
    at line 1, column 5.

Was expecting one of:

    "ACTION"
    "ANY"
    "BYTE"
    "CASCADE"
    "CAST"
    "CHANGE"
    "CHAR"
    "CHARACTER"
    "COLUMN"
    "COLUMNS"
    "COMMENT"
    "COMMIT"
    "CREATE"
    "CYCLE"
    "DESC"
    "DESCRIBE"
    "DISABLE"
    "DIV"
    "DO"
    "DOUBLE"
    "DUPLICATE"
    "ENABLE"
    "END"
    "EXCLUDE"
    "EXTRACT"
    "FALSE"
    "FIRST"
    "FN"
    "FOLLOWING"
    "FORMAT"
    "GROUP"
    "IF"
    "INDEX"
    "INSERT"
    "INTERVAL"
    "ISNULL"
    "KEY"
    "LAST"
    "LEFT"
    "LIMIT"
    "MATERIALIZED"
    "NEXTVAL"
    "NO"
    "NOLOCK"
    "NULLS"
    "OF"
    "OFFSET"
    "ON"
    "OPEN"
    "OPTIMIZE"
    "ORDER"
    "OVER"
    "PARTITION"
    "PATH"
    "PERCENT"
    "PRECISION"
    "PRIMARY"
    "PRIOR"
    "PROCEDURE"
    "PUBLIC"
    "RANGE"
    "READ"
    "REPLACE"
    "RIGHT"
    "ROW"
    "ROWS"
    "SCHEMA"
    "SEPARATOR"
    "SEQUENCE"
    "SESSION"
    "SET"
    "SIBLINGS"
    "SIZE"
    "START"
    "TABLE"
    "TABLES"
    "TEMP"
    "TEMPORARY"
    "TO"
    "TOP"
    "TRUE"
    "TRUNCATE"
    "TYPE"
    "UNSIGNED"
    "VALIDATE"
    "VALUE"
    "VALUES"
    "VIEW"
    "XML"
    "ZONE"
    <K_DATETIMELITERAL>
    <K_DATE_LITERAL>
    <S_IDENTIFIER>
    <S_QUOTED_IDENTIFIER>

Expected behavior
The statement should be parsed just fine, since it is a valid SQL statement for MariaDB

System

  • MariaDB 10.5.8
  • Java 11
  • JSqlParser version 4.0
@Aceto1 Aceto1 changed the title MariaDB "@@" throws exception Parsing "@@" throws exception Jun 22, 2021
@wumpz
Copy link
Member

wumpz commented Jun 27, 2021

This kind of "user variable" is not yet supported.

manticore-projects added a commit to manticore-projects/JSqlParser that referenced this issue Dec 16, 2022
wumpz pushed a commit that referenced this issue Dec 22, 2022
* support clickhouse global keyword in join

* fix: add missing public Getter

Add public Getter for `updateSets`
Fixes #1630

* feat: Clickhouse GLOBAL JOIN

All credits to @julianzlzhang

fixes #1615
fixes #1535

* feat: IF/ELSE statements supports Block

Make `If... Else...` statements work with Blocks
Make `Statement()` production work with `Block()`
Rewrite the `Block()` related Unit Tests

fixes #1682

* fix: Revert unintended changes to the Special Oracle Tests

* fix: `SET` statement supports `UserVariable`

Make `SetStatement` parse Objects instead of Names only
Add Grammar to accept `UserVariable` (e.g. "set @Flag = 1")
Add Test Case for `UserVariable`

fixes #1682

* feat: Google Spanner Support

Replaces PR #1415, all credit goes to @s13o
Re-arranged some recently added Tokens in alphabetical order
Update Keywords

* fix: fix JSonExpression, accept Expressions

Make JSonExpression accept Expressions
Add Testcase
Expose Idents() and Operators()
Fixes #1696

* test: add Test for Issue #1237

Co-authored-by: Zhang Zhongliang <zhangzhongliang@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants