Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to connect to database: unsupported startup parameter: IntervalStyle #62

Closed
slyngbaek opened this issue Jan 15, 2020 · 3 comments
Labels
db:postgres Related to PostgreSQL question Further information is requested

Comments

@slyngbaek
Copy link

I'm having an issue connecting to my postgres database. I get the error "failed to connect to database: unsupported startup parameter: IntervalStyle". Running on a hosted postgres (v11) with tls. Any ideas as to why I'm getting this?

main.rs

#[async_std::main]
async fn main() -> Res<()> {
    let mut pool = PgPool::new(&env::var("DATABASE_URL")?).await?;

    let rows = sqlx::query!(
        "SELECT title
        FROM product
        LIMIT 10",
    )
    .fetch_all(&mut pool)
    .await?;

    for row in rows {
        println!("row {:?}", row.get("title"));
    }

    Ok(())
}

Cargo.toml

[dependencies]
async-std = { version = "1.4.0", features = ["attributes"] }
sqlx = { version = "0.2.0", features = ["postgres", "tls"] }
@mehcode
Copy link
Member

mehcode commented Jan 16, 2020

Can I assume this is behind PgBouncer ? I'm guessing you're on Digital Ocean with the bouncer turned on.


If that's the case, we currently don't support PgBouncer. PgBouncer is not Postgres. They take a lot of shortcuts. They also don't support prepared statements ( to be pedantic, they do support prepared statements but only for the duration of a transaction instead of a session .. which means that you have to throw them in the garbage and not cache them as we currently do ).

We are planning on officially supporting PgBouncer in the near future. You are kind of stuck until then though unless you can disable the bouncer.


If I'm wrong on all counts, let me know. Additionally can you provide details like the output of the version() function and what hosting provider you're using?

Example of version() on my local box.

postgres=# SELECT version();
                                                             version                                                              
----------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 11.3 (Debian 11.3-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

@mehcode mehcode added db:postgres Related to PostgreSQL question Further information is requested labels Jan 16, 2020
@slyngbaek
Copy link
Author

You are exactly correct. I am using PgBouncer on Digital Ocean.

defaultdb=> SELECT version();
                                          version
-------------------------------------------------------------------------------------------
 PostgreSQL 11.6 on x86_64-pc-linux-gnu, compiled by gcc, a 863367dcd p 310a24bd77, 64-bit
(1 row)

@mehcode
Copy link
Member

mehcode commented Jan 16, 2020

Thanks for confirming. I'm going to close this in favor of #67. I hope you can disable the bouncer and still use SQLx in the mean time. But if not, be sure to subscribe there for updates.

@mehcode mehcode closed this as completed Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
db:postgres Related to PostgreSQL question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants