-
Notifications
You must be signed in to change notification settings - Fork 739
Closed
Labels
affinitycorrectnessgood first issueGood for newcomersGood for newcomerssqlrightbugs found using SQLRight (https://github.com/PSU-Security-Universe/sqlright)Ïbugs found using SQLRight (https://github.com/PSU-Security-Universe/sqlright)Ï
Description
Description
In non-STRICT tables, a column declared with type ANY gets BLOB affinity instead of NUMERIC affinity. This causes text values like '42' to be stored as TEXT instead of being coerced to integer.
Reproducer
CREATE TABLE t ( c ANY );
INSERT INTO t VALUES ('42');
SELECT typeof(c) FROM t;
-- Turso: text
-- SQLite: integerPer SQLite documentation, the affinity determination rules are applied sequentially: (1) contains "INT" → INTEGER, (2) contains "CHAR"/"CLOB"/"TEXT" → TEXT, (3) contains "BLOB" or no type → BLOB, (4) contains "REAL"/"FLOA"/"DOUB" → REAL, (5) "Otherwise, the affinity is NUMERIC." Since "ANY" matches none of rules 1-4, it should get NUMERIC affinity by rule 5.
core/vdbe/affinity.rs:165 - Incorrect mapping of ANY type to BLOB affinity instead of NUMERIC.
This issue brought to you by Mikaël and Claude Code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
affinitycorrectnessgood first issueGood for newcomersGood for newcomerssqlrightbugs found using SQLRight (https://github.com/PSU-Security-Universe/sqlright)Ïbugs found using SQLRight (https://github.com/PSU-Security-Universe/sqlright)Ï