Skip to content

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

Merged
simonw merged 2 commits into
simonw:mainfrom
ikatyal2110:fix-decode-default-escaped-quotes
Jul 26, 2026
Merged

Fix _decode_default_value to unescape doubled single quotes in string defaults#811
simonw merged 2 commits into
simonw:mainfrom
ikatyal2110:fix-decode-default-escaped-quotes

Conversation

@ikatyal2110

@ikatyal2110 ikatyal2110 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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/

claude and others added 2 commits July 23, 2026 14:38
… 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.
Refs simonw#811

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@simonw
simonw merged commit 6a45683 into simonw:main Jul 26, 2026
53 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.

3 participants