SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
6.56k stars 459 forks source link

Cursor on joined table #2258

Open D-Konopka opened 2 weeks ago

D-Konopka commented 2 weeks ago

Description

SeaORM assumes that column passed in cursor_by is in the original table.

Steps to Reproduce

  1. Select from table
  2. Join with another table
  3. use cursor_by using column from second table

Expected Behavior

Use table that I've specified.

Actual Behavior

SeaOrm assumes that column that I want to cursor_by is inside main table.

Reproduces How Often

Always.

Workarounds

I am not aware of any.

Reproducible Example

gallery_media::Entity::find()
        .left_join(galleries::Entity)
        .cursor_by(galleries::Column::Score);

This throws following error

Query Error: error returned from database: 1054 (42S22): Unknown column 'gallery_categories.score' in 'order clause'

Versions

├── sea-orm v0.12.15 │ ├── sea-orm-macros v0.12.15 (proc-macro) │ │ ├── sea-bae v0.2.0 (proc-macro) │ ├── sea-query v0.30.7 │ ├── sea-query-binder v0.5.0 │ │ ├── sea-query v0.30.7 (*)