SeaQL / SeaQL/sea-orm

type "schema.x_enum" does not exist - after updating to SQLX 0.8.5

Open
#2,581 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:macro
Dominant language
Rust
Stars
9.9k
Forks
735
Avg merge
6h 36m
Merged PRs (30d)
8

Description

Description

Before, to have an enum in a namespace that is not public, I would do the following:

#[derive(
    Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, JsonSchema,
)]
#[sea_orm(
    rs_type = "String",
    db_type = "Enum",
    enum_name = "SCHEMA.X_ENUM"
)]
pub enum XEnum {
    #[sea_orm(string_value = "A")]
    A,
    #[sea_orm(string_value = "B")]
    B,
}

impl IntoActiveValue<Self> for XEnum {
    fn into_active_value(self) -> sea_orm::ActiveValue<Self> {
        sea_orm::ActiveValue::Set(self.clone())
    }
}

This was hacky but it would work fine. It seems that now, after updating to sqlx 0.8.5. This breaks and returns the error type "schema.x_enum" does not exist.

Steps to Reproduce

  1. Create an enum in a separate schema
  2. Try to query it
Expected Behavior

It's queriable

Actual Behavior

Type doesn't exist

Reproduces How Often

Yes

Workarounds

I was able to work around it for now but setting the search_path to the schema, however, I am concerned about duplicate types if it ever shows up.

Reproducible Example

Versions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust enum declaration and reproduce the query against an enum in a separate schema using SQLX 0.8.5. Compare the failure with the search_path workaround; done means the schema-qualified type can be queried without relying on search_path or creating duplicate types.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.