sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Any driver does not support the Postgres type PgTypeInfo(Varchar)

Open holicc opened this issue 1 year ago • 1 comments

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 avatar Jan 09 '24 08:01 holicc

@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.

pixelspark avatar Jan 16 '24 16:01 pixelspark

Closed by #2976.

abonander avatar Mar 06 '24 03:03 abonander