sqlx
sqlx copied to clipboard
Any driver does not support the Postgres type PgTypeInfo(Varchar)
Bug Description
using AnyPool to fetch_all
Minimal Reproduction
#[tokio::test]
async fn test_any_row() -> Result<()> {
// sqlx init drivers
sqlx::any::install_default_drivers();
let pg_options =
"postgres://....".parse::<AnyConnectOptions>()?;
let pool: Pool<Any> = PoolOptions::new().connect_lazy_with(pg_options);
// set up the database connection pool
// error
let r = pool
.fetch_all("SELECT age, name FROM users")
.await?;
println!("========> {}",r.len());
for a in r {
let c: String = a.get("name");
println!("========> {}", c);
}
Ok(())
}
Info
- SQLx version: 0.7.0
- SQLx features enabled: "postgres","runtime-tokio-native-tls", "json", "chrono", "bigdecimal",
- Database server and version: PG 14.9
- Operating system: Mac M1
rustc --version: rustc 1.75.0
@holicc I ran into the same issue today, hopefully your PR gets merged soon!
A suggestion, please have a look at the full list of PgTypes and add some other. I.e. Name (a type returned from queries to information_schema) and Char probably should also be interpreted as text/string.
Closed by #2976.