duckdb / duckdb_mysql

https://duckdb.org/docs/extensions/mysql
MIT License
55 stars 13 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 2 months ago

Mytherin commented 2 months 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.