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

Import Schema should convert/map MySQL tinyint(1) to PG boolean. #303

Open
aadrian opened this issue May 8, 2024 · 2 comments
Open

Import Schema should convert/map MySQL tinyint(1) to PG boolean. #303

aadrian opened this issue May 8, 2024 · 2 comments

Comments

@aadrian
Copy link

aadrian commented May 8, 2024

Hi,

Import Schema should convert/map MySQL tinyint(1) to PG boolean (instead of the current smallint).

https://www.mysqltutorial.org/mysql-basics/mysql-boolean/

Thanks in advance.

@jeevanchalke
Copy link
Contributor

That's NOT correct.

MySQL just offers a way to represent a boolean using tinyint(1). They are NOT equivalent.

How will you differentiate between actual tinyint(1) contents and boolean?

@aadrian
Copy link
Author

aadrian commented May 8, 2024

@jeevanchalke

MySQL just offers a way to represent a boolean using tinyint(1). They are NOT equivalent.

Since to this day MySQL does not have a "native" boolean type, tinyint(1) is the convention of the last ~20 years for boolean.

Misusing tinyint(1) for something else is a bad practice (I've yet to see a real project where this would be used otherwise).

Also most ORMs and reverse tools will map it directly to boolean too, or even tools like e.g. PGLoader https://github.com/dimitri/pgloader .

How will you differentiate between actual tinyint(1) contents and boolean?

It's a convention, no need to differentiate.
(If one really wants to differentiate than a flag for the import command would do it, but as default behavior please make it boolean.)

Thank you.

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