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
This worked perfectly fine, until I tried to use a table with an ltree column.
The autogenerated entity is using an Option<String> instead of Option<PgLtree>, which then fails to deserialize with an sqlx error:
DatabaseError(Query(SqlxError(ColumnDecode { index: "\"history\"", source: "mismatched types; Rust type `core::option::Option<alloc::string::String>` (as SQL type `TEXT`) is not compatible with SQL type `ltree`" })))
Create a PostgreSQL database schema with a table using a nullable ltree column
Use sea-orm-cli to convert the schema
Try to query the table
Expected Behavior
sea-orm-cli creates an entity using the PgLtree type. Querying the entity succeeds.
Actual Behavior
sea-orm-cli creates an entity using the String (TEXT) type. Querying the entity fails.
Reproduces How Often
100% of the time.
Workarounds
I have looked into the documentation and tried the various sea-orm-cli options, but none of them made any difference.
I tried manually editing the generated entity to switch String->PgLtree, but then it does not compile:
the trait bound `sea_orm::sqlx::sqlx_postgres::types::PgLTree: std::cmp::Eq` is not satisfied
the trait `std::cmp::Eq` is implemented for `std::option::Option<T>`
required for `std::option::Option<sea_orm::sqlx::sqlx_postgres::types::PgLTree>` to implement `std::cmp::Eq`
Reproducible Example
Versions
Tested with the latest version 1.1.2
The text was updated successfully, but these errors were encountered:
Description
I am using sea-orm-cli to autogenerate entities from my existing PostgreSQL schema:
sea-orm-cli generate entity \ --output-dir src/entities \ --database-url "$DATABASE_URL" \ --with-serde both \ --serde-skip-deserializing-primary-key \ --expanded-format
This worked perfectly fine, until I tried to use a table with an
ltree
column.The autogenerated entity is using an
Option<String>
instead ofOption<PgLtree>
, which then fails to deserialize with an sqlx error:The entity looks like this:
Steps to Reproduce
Expected Behavior
sea-orm-cli creates an entity using the
PgLtree
type. Querying the entity succeeds.Actual Behavior
sea-orm-cli creates an entity using the
String
(TEXT) type. Querying the entity fails.Reproduces How Often
100% of the time.
Workarounds
I have looked into the documentation and tried the various sea-orm-cli options, but none of them made any difference.
I tried manually editing the generated entity to switch
String
->PgLtree
, but then it does not compile:Reproducible Example
Versions
Tested with the latest version 1.1.2
The text was updated successfully, but these errors were encountered: