You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ sqlc compile
# package db
migrations/20210121143728_timestamps.up.sql:11:15: syntax error near "TRIGGER `update_timestamp_collections` BEFORE UPDATE ON `collections`"
migrations/20210421162816_uuidv4.up.sql:1:15: syntax error near "FUNCTION uuidv4()"
migrations/20220117154531_migrate_collections_to_user_collections_rel.up.sql:4:17: syntax error near "PROCEDURE _migrate_collection_sort_orders()"
It looks like pingcap/parser is missing quite a lot.
I just had a look at what it would take to write a PR for the parser. In my case I have a stored procedure that uses a BEGIN/END, CURSOR, LOOP... this would be non-trivial to implement in pingcap/parser. And it's not at all relevant to sqlc I think.
As a workaround, I now preprocess my migration files and use a script to filter out the problematic statements. I then feed the processed .sql migration files to sqlc.
Activity
dansimau commentedon Jan 30, 2022
It looks like pingcap/parser is missing quite a lot.
I just had a look at what it would take to write a PR for the parser. In my case I have a stored procedure that uses a BEGIN/END, CURSOR, LOOP... this would be non-trivial to implement in pingcap/parser. And it's not at all relevant to sqlc I think.
As a workaround, I now preprocess my migration files and use a script to filter out the problematic statements. I then feed the processed .sql migration files to sqlc.
E.g. here is my Makefile:
And source for
re-filter.py: https://gist.github.com/dansimau/e8a88415cde5b22248399401bdc1b17cYMMV.
[-]mysql engine doesn't support: CREATE TRIGGER, CREATE FUNCTION, CREATE PROCEDURE[/-][+]MySQL engine doesn't support: CREATE TRIGGER, CREATE FUNCTION, CREATE PROCEDURE[/+]merlinran commentedon Apr 18, 2024
Can potentially switch to https://github.com/vitessio/vitess/tree/main/go/vt/sqlparser ? The project has https://vitess.io/docs/20.0/reference/compatibility/mysql-compatibility/