Uncompressed columns are shown in hex instead of char type

[expired user #8611]'s profile image [expired user #8611] posted 7 years ago in General Permalink

Following query results into wrong output Q1. Q1 is shown as hex output, but ist should be the string Q:

select distinct 
a.Rows,length(uncompress(a.Query)) n
,uncompress(a.Query) Q1
,cast(uncompress(a.Query) as char) Q
from MyTable a

A more simplified query example is:

select cast(uncompress(compress('abc')) as char) as test

Without cast expression you'll get hex output too, but it should be character...

(HeidiSQL, Ver. 9.4.0.5174)

kalvaro's profile image kalvaro posted 7 years ago Permalink

I cannot reproduce in MySQL/5.5.46. What's your server version?

If I recall correctly, MySQL server incorrectly reports some text columns as binary now and then and it eventually gets fixed in later releases. If that's the case, you can use the "View binary data as text (instead of HEX)" as workaround.

[expired user #8611]'s profile image [expired user #8611] posted 7 years ago Permalink

MySQL version is 5.6.27

kalvaro's profile image kalvaro posted 7 years ago Permalink

Weird... I have access to a 5.6.22 server where it doesn't happen either :-?

Please login to leave a reply, or register at first.