Skip to content

Fix _decode_default_value to unescape doubled single quotes in string defaults#811

Open
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-decode-default-escaped-quotes
Open

Fix _decode_default_value to unescape doubled single quotes in string defaults#811
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-decode-default-escaped-quotes

Conversation

@ikatyal2110

@ikatyal2110 ikatyal2110 commented Jul 23, 2026

Copy link
Copy Markdown

SQLite stores string defaults with single quotes doubled (e.g. DEFAULT 'O''Brien' is stored as 'O''Brien' in sqlite_master). The _decode_default_value function stripped the outer quotes correctly but never unescaped '' back to ', so table.default_values returned the raw escaped form instead of the actual string value. The fix adds .replace("''", "'") after stripping the outer quotes.


Generated by Claude Code


📚 Documentation preview 📚: https://sqlite-utils--811.org.readthedocs.build/en/811/

… defaults

SQLite stores string defaults with single quotes doubled (e.g. DEFAULT 'O''Brien'
is stored as the literal "'O''Brien'" in sqlite_master). The previous code
stripped the outer quotes with value[1:-1] but never converted '' back to ',
so default_values returned the raw escaped form instead of the true string value.
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.

2 participants