fix(mysql): report generated columns so SQL export excludes them - #2023
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 708c8ac96a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| internal func mysqlColumnIsGenerated(extra: String?) -> Bool { | ||
| guard let extra else { return false } | ||
| let upper = extra.uppercased() | ||
| return upper.contains("STORED GENERATED") || upper.contains("VIRTUAL GENERATED") |
There was a problem hiding this comment.
Add MariaDB Extra values to generated-column check
When exporting from MariaDB tables with generated columns, DESCRIBE/SHOW FULL COLUMNS reports Extra as VIRTUAL or PERSISTENT rather than ... GENERATED (MariaDB docs: https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/generated-columns/). Because this predicate still returns false for those values, SQL export will keep writing MariaDB generated columns into INSERT statements and strict re-imports still fail with the generated-column value error this change is meant to avoid.
Useful? React with 👍 / 👎.
708c8ac to
4ac7786
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Thanks for this. The diagnosis is right and both column-fetch paths were the correct places to set the flag. I verified I rebased onto 1. MariaDB was claimed but not covered. The PR title, the changelog line, and the plugin's
So 10.2 onward matches MySQL and your predicate already handles it; 10.1 and older report a bare marker and were missed. The KB page showing bare Two more things that turned up and are now covered by tests: MariaDB joins combined attributes with a comma ( The predicate is now the phrase match plus an exact-match fallback for the two legacy bare markers. I deliberately did not widen it to bare 2. The flag stopped at the driver, so the same bug was still live outside export.
So the flag is now threaded through I also set the flag for ClickHouse, where Still unset for MSSQL ( One caveat worth stating plainly: I have not compiled this. Please build before merging and tell me about anything that does not. |
4ac7786 to
1efd543
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
MySQL/MariaDB SQL export wrote STORED/VIRTUAL generated columns into INSERT statements, so re-importing a dump failed with error 3105.
SQLExportPluginalready excludes columns flaggedisGenerated, but the MySQL driver never set that flag despite readingExtra(which carriesSTORED GENERATED/VIRTUAL GENERATED). This maps it in both column-fetch paths —DEFAULT_GENERATED(MySQL 8 expression defaults) intentionally doesn't match, since those columns are insertable.