-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Bug Description
Currently, postgres Type would always generate Type with PgTypeInfo::with_name(#ty_name) for enum.
While we are using sqlx::Type derive with Enum and the underline type is expected to be TEXT or VARCHAR, this can result in an error:
error returned from database: type "datatype" does not exist
I suppose we can suppress this generation or use TEXT with some config options.
Minimal Reproduction
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, sqlx::Type)]
#[serde(rename_all = "snake_case")]
#[sqlx(rename_all = "snake_case")]
pub enum DataType {
Int,
UInt,
Float,
Binary,
String,
Boolean,
Interval,
Timestamp,
Variant,
Null,
}And try to insert into a DB with column data_type TEXT.
Info
- SQLx version: 0.8.2
- SQLx features enabled: ["postgres", "runtime-tokio-rustls"]
- Database server and version: [REQUIRED] Postgres 16.3
- Operating system: macOS 13.4
rustc --version: rustc 1.83.0-nightly (363ae4188 2024-09-24)
Reactions are currently unavailable