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 MEDIUMINT not supported in the Types #495

Open
Tusamarco opened this issue May 30, 2023 · 4 comments
Open

MySQL MEDIUMINT not supported in the Types #495

Tusamarco opened this issue May 30, 2023 · 4 comments

Comments

@Tusamarco
Copy link

In the driver type mapping the type MEDIUMINT is missing.
File drv_mysql.c

https://dev.mysql.com/doc/refman/8.0/en/integer-types.html

@dveeden
Copy link
Contributor

dveeden commented Jun 12, 2023

Yes it indeed looks like that's missing:

{DB_TYPE_TINYINT, MYSQL_TYPE_TINY},
{DB_TYPE_SMALLINT, MYSQL_TYPE_SHORT},
{DB_TYPE_INT, MYSQL_TYPE_LONG},
{DB_TYPE_BIGINT, MYSQL_TYPE_LONGLONG},

This would also require updates in src/db_driver.c (db_print_value) and src/db_driver.h (db_bind_type_t).

@Tusamarco maybe you could create a PR for this?

@dveeden
Copy link
Contributor

dveeden commented Jun 12, 2023

The PostgreSQL Docs say that PostgreSQL doesn't have a 3-byte integer, but only has 2, 4 and 8 byte integer types. This might make MEDIUMINT a bit complicated compatibility wise.

Note that there is support for TINYINT, which is 1 byte, but I assume that now uses a byte type or something similar for PG.

{DB_TYPE_TINYINT, 0},
{DB_TYPE_SMALLINT, 21},
{DB_TYPE_INT, 23},
{DB_TYPE_BIGINT, 20},

@Tusamarco
Copy link
Author

Well if not present in PG then when creating a test with MEDIUM int that must be marked as MySQL only.
Because trying to handle it like converting to INT for PG will also means to alter the schema definition when executing and more.
SO in short better to be aware of the limitation upfront and know that the test is limited than trying to catch any possible edge case.
at leas that is my opinion.
@dveeden what you think. (about PR true.. I can)

@dveeden
Copy link
Contributor

dveeden commented Jun 13, 2023

Yes fully agree. I think setting this to 0 in drv_pgsql.c, just like DB_TYPE_TINYINT should probably make this fail in PostgreSQL.

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

No branches or pull requests

2 participants