Open blankhart opened 4 years ago
The derive currently just ignores the schema of the type entirely I believe. Does the first code sample (with no schema qualification) not work with the type defined in a non-default schema?
That works, yes, thanks! The behavior is perhaps confusing if the schema is accepted in some cases but produces errors in others. For example, pg_mapper
accepts the schema. If it's too much to have consistency across the related packages it may be helpful to add a note to the docs for #[postgres]
.
Yeah I think it is a bit weird that the logic currently ignores the schema entirely. I think it'd definitely make sense to handle the case where the type name is schema-qualified and add a check for the schema name at that point. Would you be interested in making a PR?
Yes but I am new to Rust and databases and quite time constrained to if this is waiting on me it may be a while.
No worries!
The derived
FromSql
instance appears to fail when translating a Rust type to a Postgres type qualified by a schema name.For example, this works fine:
But this does not, the only difference being the "users." schema prefix:
The Postgres types in each case would correspond, i.e.:
Perhaps though there is a way to use the qualified Postgres type that I've overlooked?
Thank you for this wonderful library.