Open systay opened 1 week ago
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.
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: