EnterpriseDB/mysql_fdw

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

aadrian opened this issue · 2 comments

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.

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?

@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.