Shopify / ghostferry

The swiss army knife of live data migrations
https://shopify.github.io/ghostferry
MIT License
759 stars 72 forks source link

Rename lag to lag_value in tests #327

Closed pawandubey closed 2 years ago

pawandubey commented 2 years ago

lag is a keyword in MySQL 8, so using it as a column name creates syntax problems.

E.g.

This is OK in MySQL 5.7:

CREATE TABLE foo (lag FLOAT NOT NULL);

But in MySQL 8.0+, it spits out this error:

Schema Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'lag FLOAT NOT NULL)' at line 1

⏯️ Try it on DB Fiddle


Ref. New keywords in MySQL 8

insom commented 2 years ago

We also just did a version of this :nomouth: and had to change it in a few more places:

https://github.com/Shopify/ghostferry/commit/ae055aec20d023d371fef9c726222fd52dd4936a#diff-72669bd10f87a5422ac232bc8c315440c9ba0d58c996fdab16efb4628aef05a3R32

Happy for this to go in as a separate PR though as we hone in on MySQL 8.0 compatibility.

pawandubey commented 2 years ago

Aah, I think your commit seems more comprehensive. It would make sense to keep all the compatibility changes together. Will close this 🙏🏼

shuhaowu commented 2 years ago

You can also enclose it with the back ticks `.