Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dissect/database/sqlite3/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,5 @@ def get_primary_key_from_constraint(column_type_constraint: str, column_def: str
# part.
if len(primary_key_defs) == 1:
primary_key_parts = primary_key_defs[0].split(maxsplit=1)
if len(primary_key_parts) == 1:
primary_key = primary_key_parts[0]
primary_key = primary_key_parts[0].strip("'\"")
Comment thread
JSCU-CNI marked this conversation as resolved.
Resolved
return primary_key
15 changes: 15 additions & 0 deletions tests/sqlite3/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@
),
id="create-table-firefox-foreign-in-column-name",
),
# Primary key constraint with multiple parts, but not a compound/composite constraint.
pytest.param(
'CREATE TABLE "example"("foo" INTEGER, "bar" TEXT NOT NULL, PRIMARY KEY("foo" AUTOINCREMENT))',
(
"foo",
[
("foo", "INTEGER"),
("bar", "TEXT NOT NULL"),
],
[
'PRIMARY KEY("foo" AUTOINCREMENT)',
],
),
id="primary-key-constraint-multiple-parts",
)
]


Expand Down
Loading