duckdb / duckdb_mysql

https://duckdb.org/docs/extensions/mysql
MIT License
47 stars 11 forks source link

Fix #75: no longer throw when interpreting TINYINT(1) columns with non-0 or 1 values as booleans #83

Closed Mytherin closed 1 week ago

Mytherin commented 1 week ago

Fixes #75

MySQL doesn't have a proper boolean type - instead generally TINYINT(1) or BIT(1) are used to represent booleans. Since https://github.com/duckdb/duckdb_mysql/pull/26 we support loading those columns as booleans. TINYINT(1) columns, however, can contain a wider range of values than a boolean (from -128 to 127). Previously we would throw an exception when a larger number was encountered. This PR modifies the behavior so that we instead interpret numbers <= 0 as false, and numbers > 0 as true.