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

SET timestamp Syntax Error in Vitess #17170

Open
systay opened this issue Nov 7, 2024 · 1 comment
Open

SET timestamp Syntax Error in Vitess #17170

systay opened this issue Nov 7, 2024 · 1 comment

Comments

@systay
Copy link
Collaborator

systay commented Nov 7, 2024

When running the following SQL command, which is commonly issued by some ORMs and works as expected on vanilla MySQL, an error occurs in Vitess:

# vanilla mysql
mysql> SET timestamp=1690891202;
Query OK, 0 rows affected (0.01 sec)

# vitess
mysql> SET timestamp=1690891202;
syntax error at position 14 near 'timestamp'
@GuptaManan100
Copy link
Member

I was looking at this today, and I found something interesting! MySQL doesn't allow setting non-reserved keywords in general. That means the following fails -

mysql [localhost:8032] {msandbox} ((none)) > set temporary=12;
ERROR 1193 (HY000): Unknown system variable 'temporary'
mysql [localhost:8032] {msandbox} ((none)) > SET timestamp=1690891202;
Query OK, 0 rows affected (0.00 sec)

But, timestamp is special in its handling. Look at the MySQL docs - https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_timestamp
This suggests that the output of NOW() is gonna depend on this variable. How do we want to handle this? Its a session setting. We can keep track of this in vtgate, but then we would have to add special handling for NOW() function too, so that we know to substitute this variables valuw whenever the user uses NOW() in this session.

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