Keep double-quoted DEFAULT values quoted when writing table SQL by deepsidhu1313 · Pull Request #4219 · sqlitebrowser/sqlitebrowser · GitHub
Skip to content

Keep double-quoted DEFAULT values quoted when writing table SQL - #4219

Merged
mgrojo merged 2 commits into
sqlitebrowser:masterfrom
deepsidhu1313:fix/default-quoted-literal
Oct 18, 2026
Merged

mgrojo merged 2 commits into
sqlitebrowser:masterfrom
deepsidhu1313:fix/default-quoted-literal

Conversation

@deepsidhu1313

Copy link
Copy Markdown
Contributor

A column default written as DEFAULT "x" is lexed as a QUOTEDLITERAL, which
was matched by the generic id grammar rule and stored without its quotes.
The generated or exported SQL therefore contained an invalid bare default
such as DEFAULT 0000-00-00T00:00:00.000. Split the DEFAULT id rule so that
a QUOTEDLITERAL is stored as a properly escaped single-quoted string
literal using sqlb::escapeString, while bare identifiers stay as they are.

sqlite3_parser.cpp and sqlite3_parser.hpp are regenerated from the grammar
with Bison.

Fixes #4081

claude and others added 2 commits October 17, 2026 23:25
A column default written as DEFAULT "x" is lexed as a QUOTEDLITERAL, which
was matched by the generic id grammar rule and stored without its quotes.
The generated or exported SQL therefore contained an invalid bare default
such as DEFAULT 0000-00-00T00:00:00.000. Split the DEFAULT id rule so that
a QUOTEDLITERAL is stored as a properly escaped single-quoted string
literal using sqlb::escapeString, while bare identifiers stay as they are.

sqlite3_parser.cpp and sqlite3_parser.hpp are regenerated from the grammar
with Bison.

Fixes sqlitebrowser#4081

@mgrojo mgrojo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I've just added a pair of test cases which should pass.

@mgrojo
mgrojo enabled auto-merge October 18, 2026 21:00
@mgrojo
mgrojo merged commit c1acef1 into sqlitebrowser:master Oct 18, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Export to SQL does not quote default value of text fields

3 participants