First of all, I want to clarify that I have already read this question. The problem described there is quite similar to my problem but related with a bug, which has been already solved.
I have been getting strange results after querying a MySQL Server (Ver 14.14 running on Linux) through MySQL WorkBench 5.2.47 C running on Windows.
The problem is that selections on COALESCE over a list of date and string fields return BLOBS instead dates. For example
SET @dat='20130812';
SELECT COALESCE(dateA, @dat) FROM table1;
I know the problem can be fixed by casting COALESCE into DATE type:
SELECT CAST(COALESCE(dateA,$dat) AS DATE) FROM table1;
It can also be solved just casting @dat:
SELECT COALESCE(dateA,CAST(@dat AS DATE)) FROM table1;
It seems to me that it is related to internal type conversion but, why does my first query work when the client is the mysql console client? (just as described on the question linked above).
Does the client perform some type of query preprocessing? In that case, shouldn't it be common to all clients?
I used to think that SQL servers received raw queries (text) from their clients, now I realise that isn't true at all. What level of preprocessing is performed at client side?