SeaQL / sea-orm

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

no column found for name: A_ #2127

Closed brsnik closed 4 months ago

brsnik commented 4 months ago

Discussed in https://github.com/SeaQL/sea-orm/discussions/2124

Originally posted by **brsnik** March 1, 2024 This builds the correct query in terms of SQL (from what I can see in the tracer). However I get error `Query Error: no column found for name: A_barcode` ``` MvB::find() .find_with_related(MvA) // .filter(MvBColumn::Barcode.eq(gtin)) .stream_partial_model::(&conn) .await ``` My partial models: ``` #[derive(Debug, FromQueryResult, DerivePartialModel)] #[sea_orm(entity = "Entity")] pub struct MvBSearchModel { pub barcode: String, pub lbl_type: String, } ``` and ``` #[derive(Debug, FromQueryResult, DerivePartialModel)] #[sea_orm(entity = "Entity")] pub struct MvASearchModel { pub prod_art_id: i32, pub prod_art_pub_uuid: Uuid, pub lbl_status: String, } ``` The query that gets built, again it's correct: ``` SELECT "mv_b"."barcode", "mv_b"."lbl_type", "mv_a"."prod_art_id", "mv_a"."prod_art_pub_uuid", "mv_a"."lbl_status" FROM "products"."mv_b" LEFT JOIN "products"."mv_a" ON "mv_b"."prod_art_pvt_id" = "mv_a"."prod_art_pvt_id" ORDER BY "mv_b"."prod_brcd_id" ASC ``` What is causing this error? Am I doing something wrong?