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
PostgreSQL v15.
I have a db called prim, and there are two schemas called api and msg.
In api a enum type called user_status is defined, clearly, the full name is api.user_status, and the struct User has a field Status which has type UserStatus in Rust.
In sqlx 0.6, I use #sqlx(type_name = "user_status") as an attribute for type UserStatus in Rust code. and the select and insert operation refer to use api.user as full table name.
But in sqlx 0.7,
the insert raised an error says: 'type user_status' does not exist. , so I change the attribute for UserStatus to #[sqlx(type_name = "api.user_status")] and work well.
but select operation, an error called mismatched types; Rust type 'api::model::user::UserStatus' (as SQL type 'api.user_status') is not compatible with SQL type 'user_status' show there.
In sql statement to create table api.user, the type of column status is defined as api.user_status.
btw, in sqlx 0.6 select and insert has no error, but in sqlx 0.7, add schema prefix for custom type caused fail for select and delete that prefix caused fail for insert.
is that a bug?
The text was updated successfully, but these errors were encountered:
I'm also running into this; I believe it's an unintended consequence of ab2ae26, since $1::regtype::oid fails if the search path doesn't include the type. As you've discovered, fully qualifying the type name with the schema fixes that problem, but hits a bug with the custom type validation at query time: sqlx compares type names to validate custom types, but the OID lookup only gets the unqualified name of the type, not including the schema (namespace).
PostgreSQL v15.
I have a db called
prim
, and there are two schemas calledapi
andmsg
.In
api
a enum type calleduser_status
is defined, clearly, the full name isapi.user_status
, and the structUser
has a fieldStatus
which has typeUserStatus
in Rust.In
sqlx 0.6
, I use#sqlx(type_name = "user_status")
as an attribute for typeUserStatus
in Rust code. and theselect
andinsert
operation refer to useapi.user
as full table name.But in
sqlx 0.7
,the insert raised an error says:
'type user_status' does not exist.
, so I change the attribute forUserStatus
to#[sqlx(type_name = "api.user_status")]
and work well.but select operation, an error called
mismatched types; Rust type 'api::model::user::UserStatus' (as SQL type 'api.user_status') is not compatible with SQL type 'user_status'
show there.In sql statement to create table
api.user
, the type of columnstatus
is defined asapi.user_status
.btw, in
sqlx 0.6
select and insert has no error, but insqlx 0.7
, add schema prefix for custom type caused fail for select and delete that prefix caused fail for insert.is that a bug?
The text was updated successfully, but these errors were encountered: