-
-
Notifications
You must be signed in to change notification settings - Fork 156
Description
Describe the bug
I'm not sure if this strictly speaking a bug since AFAIK there's no list of officially supported DBMS versions, but it did work in 2.5.0 and isn't working in 2.6.0 so here we are.
Attempting to generate models for any schema on MySQL 5.7 results in the following database error:
Retrieving database information...
jet: Error 1064: 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 'primaryKeys AS (
SELECT k.column_name
FROM information_schema.table_constraint' at line 1
Environment (please complete the following information):
- OS: macosx 12.0.1
- Database: MySQL 5.7
- Database driver: mysql
- Jet version: 2.6.0
Expected behavior
I expect model generation to work, as it did in 2.5.0.
Additional information
The error appears to originate in GetTableColumnsMetaData()
in jet/generator/mysql/query_set.go
; it attempts to run a query that uses a CTE (WITH primaryKeys AS (...
) and MySQL 5.7 doesn't support CTE's - which is one of the many reasons I despise it, but I have to use it for now, because of reasons.
It doesn't seem too difficult to rewrite the query to avoid the CTE (at the cost of some readability), so if you're willing to accept that tradeoff to keep supporting MySQL 5.7 I'd be very happy. I could make a PR?