SeaQL/sea-orm

Invalid query generated in 1.0.1

EequalsMCsquare opened this issue · 0 comments

Description

struct VehicleVerify {
    ...
    pub service_kinds: Vec<ServiceKind>, // ServiceKind is a enum defined in the database
}

in 0.12.15, the query builder output is: CAST("vehicle_verify"."service_kinds" AS text[]) AS "B_service_kinds". However in 1.0.1 it outputs: CAST("vehicle_verify"."service_kinds" AS "text[]") AS "B_service_kinds" notice the "text[]"

Steps to Reproduce

  1. Create enum type in PG
  2. Use it in a table
  3. Generate the schema using sea-orm-cli
  4. call Entity::select().all()

Expected Behavior

Returning all the records

Actual Behavior

Got an error: DbErr=Query(SqlxError(Database(PgDatabaseError { severity: Error, code: "42704", message: "type \"text[]\" does not exist", detail: None, hint: None, position: Some(Original(819)), where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("parse_type.c"), line: Some(270), routine: Some("typenameType") })))

Reproduces How Often

Always

Workarounds

go back to 0.12.15 or write raw sql, I think

Reproducible Example

#2384

Versions

reco@192 services % cargo tree | grep sea-
│   │   │   │   │   ├── sea-orm v1.0.1
│   │   │   │   │   │   ├── sea-orm-macros v1.0.1 (proc-macro)
│   │   │   │   │   │   │   ├── sea-bae v0.2.0 (proc-macro)
│   │   │   │   │   │   ├── sea-query v0.31.1
│   │   │   │   │   │   ├── sea-query-binder v0.6.0
│   │   │   │   │   │   │   ├── sea-query v0.31.1 (*)
│   │   │   │   │   ├── sea-orm v1.0.1 (*)
│   │   │   │   ├── sea-orm v1.0.1 (*)
│   │   │   │       ├── sea-orm v1.0.1 (*)
│   │   │   ├── sea-orm v1.0.1 (*)
│   │   │   ├── sea-orm v1.0.1 (*)
│   │   ├── sea-orm v1.0.1 (*)

uname -a
Darwin 192.168.0.108 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:52:12 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6020 arm64