Data from a binary(16) column getting truncated when exposed as JSON

Hi,

I normally use BINARY(16) data type for my ID columns since I generate the value from the client using a random UUID. I successfully inserted the data to my table using the /rest/db/mytable using POST method. However, when I tried to do a GET request, it returned the record in JSON and unfortunately, the ID value was truncated.

For instance, I used the ID “c1da4213-425c-4acd-9836-3c647888cef9” when I made a POST request. When I did a GET request it returned “c1da4213-425c-4a”.

The client is an Android App and I have a local database where I store data. My concern is that the ID from the client and server will not match when this happens.

Is there a way to get the service to return the entire string?

EDIT: Not sure if this is relevant but I forgot to mention that I did not create the tables from the Schema page. I have a table creation script that I ran directly from MySQL.

Thanks,
Allen

I found a work around on this. I had to set the length of the column to 32. So from BINARY(16) to BINARY(36).

1 Like