Skip to content

fix: map BOOLEAN/BOOL column types to int affinity in column_affinity() - #865

Closed
KooshaPari wants to merge 1 commit into
simonw:mainfrom
KooshaPari:fix-7-column-affinity-boolean
Closed

KooshaPari wants to merge 1 commit into
simonw:mainfrom
KooshaPari:fix-7-column-affinity-boolean

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Sep 13, 2026

Copy link
Copy Markdown

Bug

column_affinity('BOOLEAN') and column_affinity('BOOL') returned float because BOOLEAN falls through to the NUMERIC default affinity. In Python, bool is a subclass of int, so BOOLEAN columns should have integer affinity.

Fix

Added if "BOOL" in column_type: return int before the NUMERIC fallback in column_affinity().

Testing

  • Added parametrized test_column_affinity covering BOOLEAN, BOOL, INTEGER, TEXT, REAL, BLOB, VARCHAR, DOUBLE, NUMERIC, and empty types
  • All 29 tests in test_utils.py pass

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

Copilot AI lite review requested due to automatic review settings September 13, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KooshaPari KooshaPari closed this by deleting the head repository Sep 13, 2026
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