yugabyte/yb-voyager

[MySQL] Incorrect data type conversion of INT(1) [signed] to BIGINT

ssherwood opened this issue · 1 comments

I have a table in MySQL/MariaDB defined as:

create table foo(
  id bigint(20) unsigned not null auto_increment comment 'foo\n id\n for \n foo',
  int_unsigned int(6) unsigned default null,
  int_signed int(6) default null,
  medium_unsigned mediumint(6) unsigned default null,
  medium_signed mediumint(6) default null,
  small_unsigned smallint(6) unsigned default null,
  small_signed smallint(6) default null,
  tiny_unsigned tinyint(6) unsigned default null,
  tiny_signed tinyint(6) default null,
  created_on datetime default null,
  primary key(id),
  unique key id (id)
);
alter table foo add index(created_on);

Running export schema, the count_signed int(1) column is being converted to a larger data type of bigint:

CREATE TABLE foo (
	id bigserial,
	int_unsigned bigint,
	int_signed bigint,
	medium_unsigned integer,
	medium_signed integer,
	small_unsigned integer,
	small_signed integer,
	tiny_unsigned smallint,
	tiny_signed smallint,
	created_on timestamp without time zone,
	PRIMARY KEY (id)
) ;
ALTER SEQUENCE foo_id_seq RESTART WITH 1;
COMMENT ON COLUMN foo.id IS E'foo
 id
 for 
 foo';
ALTER TABLE foo ADD UNIQUE (id);

This seems excessive since it is not unsigned like count_unsigned and should fit equally well into the PostgreSQL integer type.

This appears to be happening for smallint: smallint(n) [signed] -> integer instead of smallint