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
I have an entity model that contains an entity whose primary key is derived in part from another entity (as previously discussed in #2647). When I invoke Collection.init() on a @OneToMany collection on one of the entities, the following exception is thrown:
Stack trace
DriverException: select `p0`.* from `participant` as `p0` where `p0`.`session_id` = 3 order by `p0`.`session_id` asc, (`p0`.`member_provider_id`, `p0`.`member_user_id`) asc, (`p0`.`member_provider_id`, `p0`.`member_user_id`) asc - SQLITE_ERROR: row value misused
at SqliteExceptionConverter.convertException (C:\project\node_modules\@mikro-orm\core\platforms\ExceptionConverter.js:8:16)
at SqliteExceptionConverter.convertException (C:\project\node_modules\@mikro-orm\sqlite\SqliteExceptionConverter.js:46:22)
at SqliteDriver.convertException (C:\project\node_modules\@mikro-orm\core\drivers\DatabaseDriver.js:180:54)
at C:\project\node_modules\@mikro-orm\core\drivers\DatabaseDriver.js:184:24
at async SqliteDriver.find (C:\project\node_modules\@mikro-orm\knex\AbstractSqlDriver.js:46:24)
at async SqlEntityManager.find (C:\project\node_modules\@mikro-orm\core\EntityManager.js:105:25)
at async Collection.init (C:\project\node_modules\@mikro-orm\core\entity\Collection.js:180:23)
To Reproduce
The following test case illustrates the behavior:
Expected behavior
The query should execute successfully.
Additional context
This seems to be due to a malformed order by clause: (`s0`.`member_provider_id`, `s0`.`member_user_id`) asc generated by ObjectCriteriaNode.process. The orderBy object passed to QueryBuilder.orderBy contains the following three entries:
In the call to ObjectCriteriaNode.process for the second and third items in the list, both fields are renamed to "p0.member_provider_id~~~p0.member_user_id", which results in the QueryBuilder having the following values for QueryBuilder._orderBy:
I have an entity model that contains an entity whose primary key is derived in part from another entity (as previously discussed in #2647). When I invoke
Collection.init()
on a@OneToMany
collection on one of the entities, the following exception is thrown:Stack trace
To Reproduce
The following test case illustrates the behavior:
Expected behavior
The query should execute successfully.
Additional context
This seems to be due to a malformed
order by
clause:(`s0`.`member_provider_id`, `s0`.`member_user_id`) asc
generated byObjectCriteriaNode.process
. TheorderBy
object passed toQueryBuilder.orderBy
contains the following three entries:In the call to
ObjectCriteriaNode.process
for the second and third items in the list, both fields are renamed to"p0.member_provider_id~~~p0.member_user_id"
, which results in theQueryBuilder
having the following values forQueryBuilder._orderBy
:The SQL that is then generated produces invalid syntax in the
order by
clause.Versions
The text was updated successfully, but these errors were encountered: