From d7c6df6b463cdf00e413dbf552d4a46f4eb36c84 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Jul 2026 14:38:23 +0000 Subject: [PATCH] Fix _decode_default_value to unescape doubled single quotes in string 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. --- sqlite_utils/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index e97b7d9cb..515e5e22f 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -5212,8 +5212,8 @@ def resolve_extracts( def _decode_default_value(value: str) -> object: if value.startswith("'") and value.endswith("'"): - # It's a string - return value[1:-1] + # It's a string; unescape doubled single quotes + return value[1:-1].replace("''", "'") if value.isdigit(): # It's an integer return int(value)