Fix #4081: Quote DEFAULT values in TEXT fields when exporting SQL#4092
Open
Sohoocelery wants to merge 2 commits intosqlitebrowser:masterfrom
Open
Fix #4081: Quote DEFAULT values in TEXT fields when exporting SQL#4092Sohoocelery wants to merge 2 commits intosqlitebrowser:masterfrom
Sohoocelery wants to merge 2 commits intosqlitebrowser:masterfrom
Conversation
Contributor
|
Could you please indicate whether this would affect other data types as well? |
Author
As far as I know this would only affect DEFAULT TEXT values as it was not wrapped with quotes in the sqlitetypes branch and the error only occurred when i tried to re-import a sql file containing this data type. |
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.
Fix Description
This PR fixes issue #4081 where DEFAULT values for TEXT fields were not being properly quoted when exporting to SQL.
Problem
When exporting a database table with a TEXT column that has a DEFAULT value to SQL, the generated SQL statement was invalid:
This fails when re-importing because the unquoted value is interpreted as an invalid expression.
Solution
Modified
DefaultConstraint::toSql()insrc/sql/sqlitetypes.cppto wrap DEFAULT values in single quotes:Testing
The fix ensures that exported SQL files can be successfully re-imported without errors.