Bit field default value

[expired user #8903]'s profile image [expired user #8903] posted 10 years ago in General Permalink
I've Heidisql(9.2.0.4947)32 Bit
In previous version of Heidisql(8.3) Create statement of table containing bit value
was
`Active` BIT(1) NOT NULL DEFAULT b'0', or `Active` BIT(1) NOT NULL DEFAULT b'1',
Now the default value of BIT(1) filed is '' that is
`Active` BIT(1) NOT NULL DEFAULT b'',
with this statement if I execute the create statement it shows an sql error Invalid default value for 'Active'

please do the rest
Thank you in advance
Yogesh
[expired user #8914]'s profile image [expired user #8914] posted 10 years ago Permalink
I'm noticing this same error. I can create a bit field and assign it a default value like before, but HeidiSQL no longer recognizes that value when editing the table. If I run a DESCRIBE on the table, it still sees the correct default, but HeidiSQL can't seem to parse it properly, so it's showing b''.

To reproduce, create this table:
CREATE TABLE `test` (
`test_bit` BIT(1) NULL DEFAULT b'1'
)

Then go look at the Default column for test_bit in the main editor.
[expired user #8552]'s profile image [expired user #8552] posted 10 years ago Permalink
I am also encountering this bug. It is especially noticeable when you try to copy a table containing a bit field: you can't.

Bit fields are still buggy in general. They still cannot display more than 8 bits, and if a 16 bit value is set to '1 000 000 00' (9th bit set), it is displayed as '11.111.101', which is obviously not the same/actual value.
[expired user #8552]'s profile image [expired user #8552] posted 10 years ago Permalink
Also, BIT fields no longer seem to store/display comments.

When editing the BIT field, the following is logged by HeidiSQL:
`ALTER TABLE `ordersystem_order`
CHANGE COLUMN `enabled` `enabled` BIT(1) NOT NULL DEFAULT b'1' COMMENT 'Test Comment' AFTER `id`;`

But when I look at the table fields or the create code, no default value or comment:
`CREATE TABLE `ordersystem_order` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`enabled` BIT(1) NOT NULL DEFAULT b'',`


P.S. I'm using the latest build, 4949.

[expired user #8552]'s profile image [expired user #8552] posted 10 years ago Permalink
P.P.S. When you run a DB export on the table it does have the correct comment and default value, so it seems to be a fetching issue within the table view (and table copy function).
[expired user #8720]'s profile image [expired user #8720] posted 10 years ago Permalink
I just updated to build 9.2.0.4953 (64 Bit)
I encouter the BIT problem still in this build. It's not possible to save a BIT field if default is other than NULL. It first looks like it's saving 0 or 1 (true or false). After save, default does not display the set value and the comment is erased. Try to reenter comment shows error message Invalide default value.

Storing data 0 or 1 (true or false) however works as expected.
ansgar's profile image ansgar posted 10 years ago Permalink
Fixed in r4961. Works fine here. Please update your HeidiSQL to the latest build and report back if that works for you too.
[expired user #8914]'s profile image [expired user #8914] posted 10 years ago Permalink
Just updated to 4961 and ran a couple quick tests; everything looks good on my end. Thanks for getting this patched up!
[expired user #8903]'s profile image [expired user #8903] posted 10 years ago Permalink
Thank you very much
I've updated to Revision 4961 and now bit field value appears correctly.
Thanks again
Yogesh Kumbhar
[expired user #8720]'s profile image [expired user #8720] posted 10 years ago Permalink
I Updated to Rev. 4961 and did some test on the former Problem. It just works as expected.

Thanks very much for correction
[expired user #8552]'s profile image [expired user #8552] posted 10 years ago Permalink
Thanks a bunch, default values are working again.

It still only shows the first 8 bits of the field though (so '1100000000' in a BIT(16) field shows up as '00000000').
Not a big issue, just occasionally confusing.

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