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

GetBoolean might be called on a decimal #707

merged 2 commits into from Sep 30, 2019


Copy link

@lauxjpn lauxjpn commented Sep 30, 2019

The following test (and 1 more) currently fails in Pomelo.MySql:

It gets translated to:

SELECT COALESCE(`w0`.`IsAutomatic`, FALSE)
FROM `Weapons` AS `w`
LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id`
ORDER BY `w`.`Id`

It seems that COALESCE is returning a decimal for IsAutomatic, though the column is actually of type bit(1). The code expects a bool and calls GetBoolean, which then throws.

This fix allows the explicit conversion from decimal to bool within Row.GetBoolean().

This is not critical, so we don't need a quick release for this.

lauxjpn added 2 commits Sep 30, 2019
Signed-off-by: Laurents Meyer <>
Signed-off-by: Laurents Meyer <>
Copy link

bgrainger commented Sep 30, 2019

FWIW, the promotion of the BIT(n) data type to DECIMAL when using COALESCE is another reason why I would strongly recommend BOOL (aka TINYINT(1)) as the preferred MySQL data type for Boolean data, not BIT(1).

The PR looks good, I will merge it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants