Mysql Binary Datatype not handled correctly

6 views
Skip to first unread message

MudGuard

unread,
Feb 21, 2023, 9:04:11 AM2/21/23
to SQL Workbench/J - DBMS independent SQL tool
Hi,
with a mysql 8.0 database, a table was originally created with a column
documentId BINARY(16) a long time ago.

When I look at the table column in Database Explorer, selecting the table in the "Object" column, then choose columns on the right tabbed pane (with indexes, references and so on), I see only BINARY, not BINARY(16). For VARCHAR columns, the size is displayed. But not for BINARY.

I wanted to create an identical table (except for the name), therefore I right-clicked on the table namein the Object column, then chose "Create DDL Script".

The CREATE TABLE contains
documentId BINARY,
for that column. Looked ok to me, the same as I got displayed.

When I executed the CREATE TABLE after changing the table name, the column was displayed as
documentId BINARY
Looked good to me, the same as I saw for the old table.

I then tried copying values from the original table to the new one, but that fails ... (Error 1406 Data too long for column).
Some tests showed: the column in the new table is BINARY(1), not BINARY(16), no wonder I can't copy the 16 byte values ...

Please consider displaying the size for binary, and also use the size for the CREATE TABLE statement.


Thomas Kellerer

unread,
Feb 21, 2023, 3:12:04 PM2/21/23
to sql-wo...@googlegroups.com
Thanks I will fix this.

If you want, you can configure SQL Workbench to use MySQL to generate the table source by setting:

workbench.db.mysql.retrieve.create.table.enabled=true

in workbench.settings

This will then use "show create table ..." instead.

Regards
Thomas


MudGuard schrieb am 21.02.2023 um 15:04:> Hi,
Reply all
Reply to author
Forward
0 new messages