Closed hemberger closed 1 year ago
I think this is the same problem as https://github.com/staabm/phpstan-dba/pull/570
@hemberger this one can be closed now?
@hemberger this one can be closed now?
I think all the alias and integer issues have been resolved, but there is still an issue with AVG
(it should not be restricted to integers). Do you want me to close this and report that separately?
no lets leave it open then. thx for the update
There is the following test in
sql-ast-narrowing.php
:If I remove the alias, then I get a different (and inconsistent) type:
It looks like the only place it is correct is the associative parameter in the unaliased query, where it gets
avg(freigabe1u1): numeric-string|null
(since the result ofavg
shouldn't be an integer).Here's another example with
min
instead ofavg
.Again, only
min(freigabe1u1): int<-32768, 32767>|null
is correct, because the field is a SMALLINT, not a TINYINT.I've spot checked a few of the numeric functions, and so far they have all exhibited this behavior (avg, min, max, sum, round, abs).