Open OmegaDroid opened 11 months ago
Right now, ordering, filtering or referring to an inner related table or column is not supported. The RQB uses json aggregation to return the related tables as arrays as you can see in the raw query.
I mean, technically, it's just a json column and you can probably make it work by using json functions and knowing the aliases in the orderBy
.
Thanks @Angelelz, for now I can continue using the select
but having this supported by query
would be very handy.
I had the same scenario and had to replace all my findMany with selects =(
Any update or idea when this will get fixed? If you look at the docs, it says it would work but I have the same issue. Games with gameConfigs, gameConfigs have a column for ordering by (priority) and it just breaks no matter what way you try to orderBy.
Column parentTable.priority does not exist when appending an OrderBy at the top level.
map error when orderBy is within the with: { gameConfig: {} } section.
What version of
drizzle-orm
are you using?0.29.1
What version of
drizzle-kit
are you using?0.20.7
Describe the Bug
When ordering by a related field on a joined table using the
query
syntax the generated sql tries to order on the root table rather than the joined table.I have a
groupMembership
object that has a relateduser
(many to one):When creating a query with the
select
syntax I get the correct ordering:using the
query
syntaxIf I resolve the later query I get an error
column groupMemberships.name does not exist
.Expected behavior
I would expect the
query
syntax to order on the joined table as with theselect
syntax.Environment & setup
Running against postgres with
drizzle-orm/node-postgres