> On 3/19/15, Paul wrote: > > Maybe this question was already asked and explained. > > Or maybe it is documented somewhere (could not fiund it). > > Sorry, if this is the case, but why does > > > > SELECT '' = x''; > > > > yields 0? > > > > Because it has never before occurred to the developers that somebody > would compare a String to a Blob an expect them to be equal to one > another.
This may cause very nasty hard-to-find bugs, since SQLite allows to store any content inside BLOB field: sqlite> create table foo(a int, b int, primary key(a, b)); sqlite> insert into foo(a, b) VALUES(1, ''), (1, x''); sqlite> select *, length(b) from foo; a b length(b) ---------- ---------- ---------- 1 0 1 0 And now, using sqlite3_column_blob() + sqlite3_column_bytes() I 'see' two empty blobs, kind of...