Skip to content

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

Open
deepsidhu1313 wants to merge 1 commit into
sqlitebrowser:masterfrom
deepsidhu1313:fix/default-quoted-literal
Open

deepsidhu1313 wants to merge 1 commit 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

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

This branch has not been deployed

No deployments
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

2 participants