You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the code above with a location like { latitude: 53, longitude: 9 } results in a correct and expecected query of the following form:
select"e0".*from"events"as"e0"left join"venues"as"e1"on"e0"."venue_id"="e1"."id"order by (point(location_latitude, location_longitude) <@>point(53, 53)) asclimit10
However, when using floating point numbers (eg. { latitude: 53.46, longitude: 9.90 }), I get an error which says
ORDER BY position 46 is not in select list
Taking a closer look at the generated query shows the reason for this error, as the query by statement has an unexpected shape:
select "e0".* from "events" as "e0" left join "venues" as "e1" on "e0"."venue_id" = "e1"."id" order by 46, 53 asc limit 10
To Reproduce
Steps to reproduce the behavior:
Setup a project with Mikro ORM
Call the orderBy function of the query builder as seen above with floating point numbers
Expected behavior
The order by part of the query should look the same as if it contains integers.
Additional context
I'm usig Postgres, the Error occurred also in version 4.0.2.´
It's 100% possible that I'm missing something here, but from my current understanding, using floats should not change the generated query in this way. If there's anything that I can do to further assist this issue let me know :)
Versions
Dependency
Version
node
14.4.0
typescript
3.9.7
mikro-orm
4.2.3
pg
8.3.0
The text was updated successfully, but these errors were encountered:
The dot in float number is causing the troubles here, as it is considered as a dot between alias and property name (like a.book). When processing orderBy clause, custom expressions like this were supported more as a side effect rather than on purpose, at least the code looks like so :D
Describe the bug
As I was trying to build distance based filtering, I added a rather complex orderBy statement which worked pretty decent at first. It looks like this:
Using the code above with a location like
{ latitude: 53, longitude: 9 }
results in a correct and expecected query of the following form:However, when using floating point numbers (eg.
{ latitude: 53.46, longitude: 9.90 }
), I get an error which saysTaking a closer look at the generated query shows the reason for this error, as the query by statement has an unexpected shape:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The order by part of the query should look the same as if it contains integers.
Additional context
I'm usig Postgres, the Error occurred also in version 4.0.2.´
It's 100% possible that I'm missing something here, but from my current understanding, using floats should not change the generated query in this way. If there's anything that I can do to further assist this issue let me know :)
Versions
The text was updated successfully, but these errors were encountered: