Skip to content

DataLoader load_many and load_many_to_many can't handle capital letters in column name #2069

@Pubble

Description

@Pubble

Description

When using Vec<ModelTrait>.load_many() or Vec<ModelTrait>.load_many_to_many() rust panic: "Service panicked: Failed at mapping string to column A:1" was thrown.
After testing for a while I found out, that it panics if either the referenced column name or the owning column name starts with a capital letter.

Steps to Reproduce

  1. create table named table1 containing columns [ Id ]
  2. create table named table2 containing columns [ id, ParentId ]
  3. add foreign key to table2.ParentId referencing column Id of table1
  4. generate entity with "sea-orm-cli generate entity"
  5. get Vec<table1::Model> by using table1::Entity.find().all(db).await?
  6. use .load_many(table2::Entity, db) on the Vec<table1::Model>

Expected Behavior

Was expecing to get a Vec<Vec<table2::Model>> from load_many()

Actual Behavior

panics with "Service panicked: Failed at mapping string to column A:1"

Reproduces How Often

always

Workarounds

Changing the names of columns and tables to lower case works fine for me.

Versions

Database: PostgreSQL
OS: Windows 11 Pro
Postgres: 14
Sea Orm:

sea-orm v0.12.11
│   ├── async-stream v0.3.5
│   │   ├── async-stream-impl v0.3.5 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   ├── quote v1.0.35 (*)
│   │   │   └── syn v2.0.48 (*)
│   │   ├── futures-core v0.3.30
│   │   └── pin-project-lite v0.2.13
│   ├── async-trait v0.1.77 (proc-macro) (*)
│   ├── bigdecimal v0.3.1
│   │   ├── num-bigint v0.4.4 (*)
│   │   ├── num-integer v0.1.45 (*)
│   │   └── num-traits v0.2.17 (*)
│   ├── chrono v0.4.31 (*)
│   ├── futures v0.3.30
│   │   ├── futures-channel v0.3.30 (*)
│   │   ├── futures-core v0.3.30
│   │   ├── futures-io v0.3.30
│   │   ├── futures-sink v0.3.30
│   │   ├── futures-task v0.3.30
│   │   └── futures-util v0.3.30 (*)
│   ├── log v0.4.20
│   ├── ouroboros v0.17.2
│   │   ├── aliasable v0.1.3
│   │   ├── ouroboros_macro v0.17.2 (proc-macro)
│   │   │   ├── heck v0.4.1 (*)
│   │   │   ├── proc-macro-error v1.0.4
│   │   │   │   ├── proc-macro-error-attr v1.0.4 (proc-macro)
│   │   │   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   │   │   └── quote v1.0.35 (*)
│   │   │   │   │   [build-dependencies]
│   │   │   │   │   └── version_check v0.9.4
│   │   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   │   ├── quote v1.0.35 (*)
│   │   │   │   └── syn v1.0.109
│   │   │   │       ├── proc-macro2 v1.0.76 (*)
│   │   │   │       ├── quote v1.0.35 (*)
│   │   │   │       └── unicode-ident v1.0.12
│   │   │   │   [build-dependencies]
│   │   │   │   └── version_check v0.9.4
│   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   ├── quote v1.0.35 (*)
│   │   │   └── syn v2.0.48 (*)
│   │   └── static_assertions v1.1.0
│   ├── rust_decimal v1.33.1
│   │   ├── arrayvec v0.7.4
│   │   ├── num-traits v0.2.17 (*)
│   │   └── serde v1.0.195 (*)
│   ├── sea-orm-macros v0.12.11 (proc-macro)
│   │   ├── heck v0.4.1 (*)
│   │   ├── proc-macro2 v1.0.76 (*)
│   │   ├── quote v1.0.35 (*)
│   │   ├── sea-bae v0.2.0 (proc-macro)
│   │   │   ├── heck v0.4.1 (*)
│   │   │   ├── proc-macro-error v1.0.4 (*)
│   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   ├── quote v1.0.35 (*)
│   │   │   └── syn v2.0.48 (*)
│   │   ├── syn v2.0.48 (*)
│   │   └── unicode-ident v1.0.12
│   ├── sea-query v0.30.7
│   │   ├── bigdecimal v0.3.1 (*)
│   │   ├── chrono v0.4.31 (*)
│   │   ├── derivative v2.2.0 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   ├── quote v1.0.35 (*)
│   │   │   └── syn v1.0.109 (*)
│   │   ├── inherent v1.0.11 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   ├── quote v1.0.35 (*)
│   │   │   └── syn v2.0.48 (*)
│   │   ├── ordered-float v3.9.2
│   │   │   └── num-traits v0.2.17 (*)
│   │   ├── rust_decimal v1.33.1 (*)
│   │   ├── sea-query-derive v0.4.1 (proc-macro)
│   │   │   ├── heck v0.4.1 (*)
│   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   ├── quote v1.0.35 (*)
│   │   │   ├── syn v2.0.48 (*)
│   │   │   └── thiserror v1.0.56 (*)
│   │   ├── serde_json v1.0.111 (*)
│   │   ├── time v0.3.31 (*)
│   │   └── uuid v1.6.1
│   │       └── serde v1.0.195 (*)
│   ├── sea-query-binder v0.5.0
│   │   ├── bigdecimal v0.3.1 (*)
│   │   ├── chrono v0.4.31 (*)
│   │   ├── rust_decimal v1.33.1 (*)
│   │   ├── sea-query v0.30.7 (*)
│   │   ├── serde_json v1.0.111 (*)
│   │   ├── sqlx v0.7.3
│   │   │   ├── sqlx-core v0.7.3
│   │   │   │   ├── ahash v0.8.7 (*)
│   │   │   │   ├── atoi v2.0.0
│   │   │   │   │   └── num-traits v0.2.17 (*)
│   │   │   │   ├── bigdecimal v0.3.1 (*)
│   │   │   │   ├── byteorder v1.5.0
│   │   │   │   ├── bytes v1.5.0
│   │   │   │   ├── chrono v0.4.31 (*)
│   │   │   │   ├── crc v3.0.1
│   │   │   │   │   └── crc-catalog v2.4.0
│   │   │   │   ├── crossbeam-queue v0.3.11
│   │   │   │   │   └── crossbeam-utils v0.8.19
│   │   │   │   ├── dotenvy v0.15.7
│   │   │   │   ├── either v1.9.0 (*)
│   │   │   │   ├── event-listener v2.5.3
│   │   │   │   ├── futures-channel v0.3.30 (*)
│   │   │   │   ├── futures-core v0.3.30
│   │   │   │   ├── futures-intrusive v0.5.0
│   │   │   │   │   ├── futures-core v0.3.30
│   │   │   │   │   ├── lock_api v0.4.11 (*)
│   │   │   │   │   └── parking_lot v0.12.1 (*)
│   │   │   │   ├── futures-io v0.3.30
│   │   │   │   ├── futures-util v0.3.30 (*)
│   │   │   │   ├── hashlink v0.8.4
│   │   │   │   │   └── hashbrown v0.14.3 (*)
│   │   │   │   ├── hex v0.4.3
│   │   │   │   ├── indexmap v2.1.0 (*)
│   │   │   │   ├── log v0.4.20
│   │   │   │   ├── memchr v2.7.1
│   │   │   │   ├── once_cell v1.19.0
│   │   │   │   ├── paste v1.0.14 (proc-macro)
│   │   │   │   ├── percent-encoding v2.3.1
│   │   │   │   ├── rust_decimal v1.33.1 (*)
│   │   │   │   ├── serde v1.0.195 (*)
│   │   │   │   ├── serde_json v1.0.111 (*)
│   │   │   │   ├── sha2 v0.10.8
│   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   ├── cpufeatures v0.2.12
│   │   │   │   │   └── digest v0.10.7 (*)
│   │   │   │   ├── smallvec v1.12.0
│   │   │   │   ├── sqlformat v0.2.3
│   │   │   │   │   ├── itertools v0.12.0 (*)
│   │   │   │   │   ├── nom v7.1.3 (*)
│   │   │   │   │   └── unicode_categories v0.1.1
│   │   │   │   ├── thiserror v1.0.56 (*)
│   │   │   │   ├── time v0.3.31 (*)
│   │   │   │   ├── tokio v1.35.1 (*)
│   │   │   │   ├── tokio-stream v0.1.14
│   │   │   │   │   ├── futures-core v0.3.30
│   │   │   │   │   ├── pin-project-lite v0.2.13
│   │   │   │   │   └── tokio v1.35.1 (*)
│   │   │   │   ├── tracing v0.1.40 (*)
│   │   │   │   ├── url v2.5.0
│   │   │   │   │   ├── form_urlencoded v1.2.1 (*)
│   │   │   │   │   ├── idna v0.5.0
│   │   │   │   │   │   ├── unicode-bidi v0.3.14
│   │   │   │   │   │   └── unicode-normalization v0.1.22
│   │   │   │   │   │       └── tinyvec v1.6.0
│   │   │   │   │   │           └── tinyvec_macros v0.1.1
│   │   │   │   │   └── percent-encoding v2.3.1
│   │   │   │   └── uuid v1.6.1 (*)
│   │   │   ├── sqlx-macros v0.7.3 (proc-macro)
│   │   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   │   ├── quote v1.0.35 (*)
│   │   │   │   ├── sqlx-core v0.7.3 (*)
│   │   │   │   ├── sqlx-macros-core v0.7.3
│   │   │   │   │   ├── atomic-write-file v0.1.2
│   │   │   │   │   │   └── rand v0.8.5
│   │   │   │   │   │       ├── rand_chacha v0.3.1
│   │   │   │   │   │       │   ├── ppv-lite86 v0.2.17
│   │   │   │   │   │       │   └── rand_core v0.6.4
│   │   │   │   │   │       │       └── getrandom v0.2.12 (*)
│   │   │   │   │   │       └── rand_core v0.6.4 (*)
│   │   │   │   │   ├── dotenvy v0.15.7
│   │   │   │   │   ├── either v1.9.0 (*)
│   │   │   │   │   ├── heck v0.4.1 (*)
│   │   │   │   │   ├── hex v0.4.3
│   │   │   │   │   ├── once_cell v1.19.0
│   │   │   │   │   ├── proc-macro2 v1.0.76 (*)
│   │   │   │   │   ├── quote v1.0.35 (*)
│   │   │   │   │   ├── serde v1.0.195
│   │   │   │   │   │   └── serde_derive v1.0.195 (proc-macro) (*)
│   │   │   │   │   ├── serde_json v1.0.111 (*)
│   │   │   │   │   ├── sha2 v0.10.8 (*)
│   │   │   │   │   ├── sqlx-core v0.7.3 (*)
│   │   │   │   │   ├── sqlx-postgres v0.7.3
│   │   │   │   │   │   ├── atoi v2.0.0 (*)
│   │   │   │   │   │   ├── base64 v0.21.7
│   │   │   │   │   │   ├── bigdecimal v0.3.1 (*)
│   │   │   │   │   │   ├── bitflags v2.4.1
│   │   │   │   │   │   ├── byteorder v1.5.0
│   │   │   │   │   │   ├── chrono v0.4.31
│   │   │   │   │   │   │   ├── num-traits v0.2.17 (*)
│   │   │   │   │   │   │   └── windows-targets v0.48.5 (*)
│   │   │   │   │   │   ├── crc v3.0.1 (*)
│   │   │   │   │   │   ├── dotenvy v0.15.7
│   │   │   │   │   │   ├── etcetera v0.8.0
│   │   │   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   │   │   ├── home v0.5.9
│   │   │   │   │   │   │   │   └── windows-sys v0.52.0
│   │   │   │   │   │   │   │       └── windows-targets v0.52.0 (*)
│   │   │   │   │   │   │   └── windows-sys v0.48.0
│   │   │   │   │   │   │       └── windows-targets v0.48.5 (*)
│   │   │   │   │   │   ├── futures-channel v0.3.30
│   │   │   │   │   │   │   ├── futures-core v0.3.30
│   │   │   │   │   │   │   └── futures-sink v0.3.30
│   │   │   │   │   │   ├── futures-core v0.3.30
│   │   │   │   │   │   ├── futures-io v0.3.30
│   │   │   │   │   │   ├── futures-util v0.3.30
│   │   │   │   │   │   │   ├── futures-core v0.3.30
│   │   │   │   │   │   │   ├── futures-io v0.3.30
│   │   │   │   │   │   │   ├── futures-sink v0.3.30
│   │   │   │   │   │   │   ├── futures-task v0.3.30
│   │   │   │   │   │   │   ├── memchr v2.7.1
│   │   │   │   │   │   │   ├── pin-project-lite v0.2.13
│   │   │   │   │   │   │   ├── pin-utils v0.1.0
│   │   │   │   │   │   │   └── slab v0.4.9 (*)
│   │   │   │   │   │   ├── hex v0.4.3
│   │   │   │   │   │   ├── hkdf v0.12.4
│   │   │   │   │   │   │   └── hmac v0.12.1
│   │   │   │   │   │   │       └── digest v0.10.7 (*)
│   │   │   │   │   │   ├── hmac v0.12.1 (*)
│   │   │   │   │   │   ├── home v0.5.9 (*)
│   │   │   │   │   │   ├── itoa v1.0.10
│   │   │   │   │   │   ├── log v0.4.20
│   │   │   │   │   │   ├── md-5 v0.10.6
│   │   │   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   │   │   └── digest v0.10.7 (*)
│   │   │   │   │   │   ├── memchr v2.7.1
│   │   │   │   │   │   ├── num-bigint v0.4.4 (*)
│   │   │   │   │   │   ├── once_cell v1.19.0
│   │   │   │   │   │   ├── rand v0.8.5 (*)
│   │   │   │   │   │   ├── rust_decimal v1.33.1 (*)
│   │   │   │   │   │   ├── serde v1.0.195 (*)
│   │   │   │   │   │   ├── serde_json v1.0.111 (*)
│   │   │   │   │   │   ├── sha1 v0.10.6
│   │   │   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   │   │   ├── cpufeatures v0.2.12
│   │   │   │   │   │   │   └── digest v0.10.7 (*)
│   │   │   │   │   │   ├── sha2 v0.10.8 (*)
│   │   │   │   │   │   ├── smallvec v1.12.0
│   │   │   │   │   │   ├── sqlx-core v0.7.3 (*)
│   │   │   │   │   │   ├── stringprep v0.1.4
│   │   │   │   │   │   │   ├── finl_unicode v1.2.0
│   │   │   │   │   │   │   ├── unicode-bidi v0.3.14
│   │   │   │   │   │   │   └── unicode-normalization v0.1.22 (*)
│   │   │   │   │   │   ├── thiserror v1.0.56 (*)
│   │   │   │   │   │   ├── time v0.3.31
│   │   │   │   │   │   │   ├── deranged v0.3.11
│   │   │   │   │   │   │   │   └── powerfmt v0.2.0
│   │   │   │   │   │   │   ├── itoa v1.0.10
│   │   │   │   │   │   │   ├── powerfmt v0.2.0
│   │   │   │   │   │   │   ├── time-core v0.1.2
│   │   │   │   │   │   │   └── time-macros v0.2.16 (proc-macro) (*)
│   │   │   │   │   │   ├── tracing v0.1.40 (*)
│   │   │   │   │   │   ├── uuid v1.6.1
│   │   │   │   │   │   └── whoami v1.4.1
│   │   │   │   │   ├── syn v1.0.109 (*)
│   │   │   │   │   ├── tempfile v3.9.0
│   │   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   │   ├── fastrand v2.0.1
│   │   │   │   │   │   └── windows-sys v0.52.0 (*)
│   │   │   │   │   ├── tokio v1.35.1
│   │   │   │   │   │   ├── bytes v1.5.0
│   │   │   │   │   │   ├── mio v0.8.10 (*)
│   │   │   │   │   │   ├── pin-project-lite v0.2.13
│   │   │   │   │   │   ├── socket2 v0.5.5 (*)
│   │   │   │   │   │   └── windows-sys v0.48.0 (*)
│   │   │   │   │   └── url v2.5.0 (*)
│   │   │   │   └── syn v1.0.109 (*)
│   │   │   └── sqlx-postgres v0.7.3
│   │   │       ├── atoi v2.0.0 (*)
│   │   │       ├── base64 v0.21.7
│   │   │       ├── bigdecimal v0.3.1 (*)
│   │   │       ├── bitflags v2.4.1
│   │   │       ├── byteorder v1.5.0
│   │   │       ├── chrono v0.4.31 (*)
│   │   │       ├── crc v3.0.1 (*)
│   │   │       ├── dotenvy v0.15.7
│   │   │       ├── etcetera v0.8.0 (*)
│   │   │       ├── futures-channel v0.3.30 (*)
│   │   │       ├── futures-core v0.3.30
│   │   │       ├── futures-io v0.3.30
│   │   │       ├── futures-util v0.3.30 (*)
│   │   │       ├── hex v0.4.3
│   │   │       ├── hkdf v0.12.4 (*)
│   │   │       ├── hmac v0.12.1 (*)
│   │   │       ├── home v0.5.9 (*)
│   │   │       ├── itoa v1.0.10
│   │   │       ├── log v0.4.20
│   │   │       ├── md-5 v0.10.6 (*)
│   │   │       ├── memchr v2.7.1
│   │   │       ├── num-bigint v0.4.4 (*)
│   │   │       ├── once_cell v1.19.0
│   │   │       ├── rand v0.8.5
│   │   │       │   ├── rand_chacha v0.3.1 (*)
│   │   │       │   └── rand_core v0.6.4 (*)
│   │   │       ├── rust_decimal v1.33.1 (*)
│   │   │       ├── serde v1.0.195 (*)
│   │   │       ├── serde_json v1.0.111 (*)
│   │   │       ├── sha1 v0.10.6 (*)
│   │   │       ├── sha2 v0.10.8 (*)
│   │   │       ├── smallvec v1.12.0
│   │   │       ├── sqlx-core v0.7.3 (*)
│   │   │       ├── stringprep v0.1.4 (*)
│   │   │       ├── thiserror v1.0.56 (*)
│   │   │       ├── time v0.3.31 (*)
│   │   │       ├── tracing v0.1.40 (*)
│   │   │       ├── uuid v1.6.1 (*)
│   │   │       └── whoami v1.4.1
│   │   ├── time v0.3.31 (*)
│   │   └── uuid v1.6.1 (*)
│   ├── serde v1.0.195 (*)
│   ├── serde_json v1.0.111 (*)
│   ├── sqlx v0.7.3 (*)
│   ├── strum v0.25.0
│   ├── thiserror v1.0.56 (*)
│   ├── time v0.3.31 (*)
│   ├── tracing v0.1.40 (*)
│   ├── url v2.5.0 (*)
│   └── uuid v1.6.1 (*)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions