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

BUG: Element types don't match MySQL: query-results have inconsistent types #2847

Open
samjewell opened this issue Feb 7, 2025 · 0 comments

Comments

@samjewell
Copy link
Contributor

Problem

GMS should make sure that all elements within a single column in the query-result share the same type.

It doesn't, and so is not consistent with MySQL behaviour.

Reproduction:

Given the following SQL:

CREATE TABLE people (name VARCHAR(50), age INT);
INSERT INTO people VALUES ('sam', 44), ('ben', NULL);

SELECT name, coalesce(age, 0.0) AS coalesced FROM people;

I should see the coalesced column containing floats.
And it does on SQLFiddle: https://sqlfiddle.com/mysql/online-compiler?id=8c51ae86-a4ae-4dbf-8ecd-0d56803fdb5d
Image

But in GMS the 44 comes back as (int64) 44, while the 0 value comes back as (string) (len=3) "0.0"

I've written a failing test case for this, and pushed it up into a PR so you can take a look - see this PR: #2846

I don't know how to fix this issue, but I'm certain it doesn't match what MySQL does here.

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

No branches or pull requests

2 participants