Repository navigation
fix: escape quotes in string defaults on export and unescape them on import - #1062
Merged
huydo862003 merged 4 commits intoDec 2, 2026
Merged
Conversation
huydo862003
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A string default with a quote in it broke conversion both ways.
DEFAULT 'Don''t panic'kept the SQL escaping. Postgres, MySQL and MSSQL gave the default asDon''t panic, MySQL also kept backslash escapes ('C:\\temp','Don\'t') and charset introducers (_utf8mb4'xxx'came out asutf8mb4'xxx). The DBML exporter then wrote these unescaped, and the result didn't parse (Expect a comma ',').[default: 'Don\'t panic']becameDEFAULT 'Don't panic', which the database rejects.The importers now decode string literals:
''for all three, and for MySQL also backslash escapes andN/charset prefixes. For Postgres this happens once, invisitAnysconst, so comments and INSERT records get it too, and the separate unescape for comments is removed. The exporters escape string defaults and enum values the way they already escape notes and records (MySQL also escapes\).Two fixtures encoded the old output and are updated:
mysql_importer/ddl_create(c3is now'xxx') andmssql-parse/insert(test''s valueis nowtest's value). Added tests for the importers and exporters.Not covered: the live-database connectors (
db2dbml) still return defaults with''doubled.