On 19 Mar 2015, at 2:56pm, Paul <devgs at ukr.net> 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?

One is a string.  The other is a BLOB.  SQLite doesn't even get as far as 
testing the contents, it knows they are of different types.

Although the two types have many things in common and can be treated the same 
for many operations, they're different.  Like INTEGER and REAL.  Though INTEGER 
and REAL fail the '=' test you use above, which I accept makes things confusing.

> Suppose I have data in FOO table. By what means can I tell 
> what is inside of my_blob column of FOO, when
> 
> SELECT length(my_blob) FROM FOO;
> 
> returns 0 for both empty string('') and empty blob (x'') alike? 

SELECT typeof(my_blob),length(my_blob) FROM FOO;

> And what is the reason behind this difference?

Harder for me to answer unless I know why you think they should be the same.

Simon.

Reply via email to