Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ssherwood opened this issue Mar 27, 2024 · 1 comment
Open
Labels
triage Needs to be triaged

Comments

@ssherwood
Copy link

ssherwood commented Mar 27, 2024

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.

@github-actions github-actions bot added the triage Needs to be triaged label Mar 27, 2024
@ssherwood
Copy link
Author

ssherwood commented Mar 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant