On Fri, Nov 11, 2011 at 1:16 PM, Simon Slavin <slav...@bigfraud.org> wrote: > On 11 Nov 2011, at 6:09pm, Nico Williams wrote: >> blob = blob should be a binary comparison >> >> blob = string should be a string comparison >> >> blob LIKE pattern should either treat the blob as a string or not, but >> I don't see why either behavior should imply that blob = blob should >> be anything but a binary comparison or blob = string anything other >> than a string comparison. >> >> I personally see no reason why LIKE shouldn't apply the pattern to the >> whole blob, but GLOB and REGEXP must apply only to strings (or BLOBs >> cast to TEXT). > > You know, actually the only one of those I think should work is the first: > you can compare two blobs for identity. Anything which treats a BLOB like a > string should yield an error of some kind (null ?). I think of a BLOB as a > black box of some kind: you treat it as a whole, and don't look inside it. > If you want parts of it you need to know whether to treat it as a string, a > float, a colour, etc..
I like the ability to cast blobs to text. I do agree that NULs in blobs must be treated as string ending NULs (if nothing else because TEXT in SQLite3 is supposed to be Unicode). But I would agree that an explicit cast should be required, that blobs and text should always compare as not equal unless a cast is involved. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users