Boolean is Byte in MySQL

1,055 views
Skip to first unread message

Juan Miguel Cejuela

unread,
Nov 15, 2011, 5:23:26 PM11/15/11
to jooq...@googlegroups.com
Hi there,

using MySQL 5.5.15 my columns with type BOOL or BOOLEAN get converted into Byte.

Is this normal or is this a bug? Workaround now is tinyint(1) ?


Thanks, //keep the amazing good work Lukas



--
Juan Miguel Cejuela
   jua...@jmcejuela.com
   jmcejuela.com
   +49 176 627 581 05

Juan Miguel Cejuela

unread,
Nov 15, 2011, 5:54:39 PM11/15/11
to jooq...@googlegroups.com
well, tinyint(1) gets converted to Byte too. After all bool, boolean are synonyms to tinyint(1) in mysql


2011/11/15 Juan Miguel Cejuela <jua...@jmcejuela.com>

Lukas Eder

unread,
Nov 15, 2011, 6:07:58 PM11/15/11
to jooq...@googlegroups.com
Hello Juan,

You're right. MySQL doesn't really know a true boolean type:
http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html

It uses "bool" / "boolean" for compatibility reasons with other
databases, that support true booleans. See also this page:
http://dev.mysql.com/doc/refman/5.5/en/other-vendor-data-types.html

Currently, there is no custom type mapping in jOOQ, so your boolean
column is mapped to Byte. This reminds me that I should actually
implement a custom type mapping configuration in jooq-meta /
jooq-codegen:
https://sourceforge.net/apps/trac/jooq/ticket/947

Cheers
Lukas

2011/11/15 Juan Miguel Cejuela <jua...@jmcejuela.com>:

stefan...@gmail.com

unread,
Jun 1, 2016, 12:40:06 PM6/1/16
to jOOQ User Group
I am currently switching from PostgreSQL to MySQL .. I know I know.. but I'm facing the same issue XD

I'm just going to create another converter for that type unless there is a simpler solution by now :)

BR; Stefan

Lukas Eder

unread,
Jun 1, 2016, 2:21:02 PM6/1/16
to jooq...@googlegroups.com
Hi Stefan,

Lucky you :)

No, there's no better solution by now (wow, 5 years already!). You can choose between data type rewriting, data type converters, or data type bindings:

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stefan...@gmail.com

unread,
Jun 1, 2016, 2:28:27 PM6/1/16
to jOOQ User Group
Yeah, time goes by so fast it almost scares me XD what am I doing with my free time .. 

Alright, I think I will be able to handle that :)


:D

Lukas Eder

unread,
Jun 2, 2016, 2:08:14 AM6/2/16
to jooq...@googlegroups.com
Don't worry, I have an alert. I eventually see the questions :)
Reply all
Reply to author
Forward
0 new messages