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

Add @@SESSION as reserved word for MySQL #59

Closed
zendesk-jjtheo opened this issue Jun 14, 2022 · 2 comments
Closed

Add @@SESSION as reserved word for MySQL #59

zendesk-jjtheo opened this issue Jun 14, 2022 · 2 comments

Comments

@zendesk-jjtheo
Copy link

@@SESSION is a reserved word in MySQL. https://dev.mysql.com/doc/refman/8.0/en/session-state-tracking.html
The formatter is currently adding a space after the first @ as it's considering it as a special word char.

Maybe a same fix as #42 would work? although it's not an operator in MySQL

@vertical-blank
Copy link
Owner

@zendesk-jjtheo
As a workaround, try this.

String sql = SqlFormatter.extend(cfg -> cfg.plusReservedWords("@@SESSION"))
            .format("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';");
System.out.println(sql);

output:

SET
  @@SESSION.session_track_transaction_info = 'CHARACTERISTICS';

@zendesk-jjtheo
Copy link
Author

@vertical-blank Thank you!

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

No branches or pull requests

2 participants