jet
jet copied to clipboard
COALESCE missing in MySQL
Describe the bug
The postgres dialect exports COALESCE in postgres/functions.go, but the MySQL dialect lacks it. It's a pretty ubiquitous function, so I believe this is probably a bug.
Code snippet
q := Film.SELECT(
Film.Title,
IntExp(COALESCE(Film.Length, Int(0))).AS("length_not_null")
)
Expected behavior
I expect COALESCE to be available the MySQL dialect.
As a minor feature request, I think it'd be pretty nice to have the functions listed somewhere on the wiki. Some of them are already on the "Expressions" page, and to be fair a lot of them are just the exact same keywords as in SQL, but when you're new to the library it really helps to just know for sure that they do exist (and especially so when it comes to Jet-specific variants like SUMf() - it shows up in examples, but again, a reference would be nice).
Having typed this out I now realize that in the time it took I could just have submitted a PR instead. :/
Hi @kblomster . Yeah, it seems those functions are missing for MySQL. Wiki update PR also welcomed.
Hmm, it looks like they are missing for SQLite as well.
Fixed with 2.9.0 release.