Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: emanuele on March 5th, 2015, 09:44 PM

Title: Data too long for column 'featured' at row 1
Post by: emanuele on March 5th, 2015, 09:44 PM
Clean install of the current HEAD of the master branch.
MySQL 5.6.17.

Creating an album I got this message:
Code: [Select]
Data too long for column 'featured' at row 1
File: /home/emanuele/webserver/htdocs/wedge/gz/app/media_Aeva-Gallery2.php
Line: 1675

The workaround I used is to change the column to tinyint. :P
Title: Re: Data too long for column 'featured' at row 1
Post by: Pandos on March 6th, 2015, 08:29 AM
Yes! THX for the find.
BIT should be instead tinyint. Means the same, but display is handled very different.
And "outdated" since MySQL 5.0.3 ;)

PR is on the way.
Title: Re: Data too long for column 'featured' at row 1
Post by: Nao on March 6th, 2015, 04:43 PM
http://dev.mysql.com/doc/refman/5.0/en/bit-type.html

It's not 'outdated', it's just that it's stricter... (Or did BIT even exist before 5.0...?)

I've never met this problem, though!
Then again, I think wedge.org is mostly running on TINYINT field (otherwise I'd have had to convert manually, and I don't think I did. At least not all fields...) My local install is working fine, and that's with a recent MySQL, so I don't know... Setting, or something?

Apparently, the solution would be to use SET field = b'0' or b'1' instead of SET field = 0 or 1, but it's ugly...

I should remind you that I actually modified the database years ago to use BIT instead of TINYINT where possible... :^^;: (For reasons of "saving space", IIRC. Someone must have advocated for this...)
Going back doesn't sound great to me... :(
Title: Re: Data too long for column 'featured' at row 1
Post by: Pandos on March 6th, 2015, 05:19 PM
It depends also on client version.
There are some fields using BIT in Wedge.
Take a look at the PR.
Also BIT columns does'nt play nice with indexes. :)

Also interesting:
Why you should NOT use BIT columns in MySQL(http://www.xaprb.com/blog/2006/04/11/bit-values-in-mysql/)

So for me it's fine to have it in tinyint.