Unexpected behavior with bit(8) column
I have a column in an array set to bit(8), 7 for the days of the week and one for holidays. I added the column using HeidiSQL which generated the following comman:
ALTER TABLE `main`
ADD COLUMN `open_at` BIT(8) NULL DEFAULT NULL AFTER `promote`;
Now, for some reason I can only update the first 7 bits of the column with the expected result. So running the following update works fine:
UPDATE main SET open_at = b'1000001' WHERE id ='2297';
SELECT open_at FROM main WHERE id='2297';
Is producing 01000001 as expected. However using all 8 bits is producing some sort of an overflow. for example, running:
UPDATE main SET open_at = b'10000001' WHERE id ='2297';
SELECT open_at FROM main WHERE id='2297';
is producing 11111101, and without an error. In fact, every 8 long bit combination I tried produced 11111101. I have tried creating longer bit(9) and bit(10) thinking there might be an issue with just the last bit, but the 8-th bit seem to be broken even if the column is larger. Please help.