-
-
Notifications
You must be signed in to change notification settings - Fork 250
Closed
Description
Description
When using the cast_as_quoted function to cast schema-qualified enums (e.g., schema_name.enum_name), the generated SQL incorrectly quotes the entire identifier as "schema_name.enum_name". Instead, each part of the schema and enum should be quoted separately, like "schema_name"."enum_name", to ensure correctness.
Steps to Reproduce
- Define a schema-qualified enum:
CREATE TYPE schema_name.enum_name AS ENUM ('value1', 'value2');
- Use SeaQuery to cast a value using
cast_as_quoted:use sea_query::{tests_cfg::*, *}; let query = Query::select() .expr(Func::cast_as_quoted( "some_value", Alias::new("schema_name.enum_name"), '"'.into(), )) .to_owned();
- Generate the SQL for PostgreSQL:
assert_eq!( query.to_string(PostgresQueryBuilder), r#"SELECT CAST('some_value' AS "schema_name.enum_name")"# );
Expected Behavior
The SQL should be generated as:
SELECT CAST('some_value' AS "schema_name"."enum_name")Actual Behavior
The SQL is incorrectly generated as:
SELECT CAST('some_value' AS "schema_name.enum_name")Reproduces How Often
Always.
Versions
- SeaQuery: 0.31.1
- PostgreSQL: Irrelevant
- OS: Irrelevant
Additional Information
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels