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

Problem with the postgress cluster #100

Open
Alexey-Gribchenkov opened this issue Jul 18, 2023 · 1 comment
Open

Problem with the postgress cluster #100

Alexey-Gribchenkov opened this issue Jul 18, 2023 · 1 comment

Comments

@Alexey-Gribchenkov
Copy link

When the deployment occurs, the following error occurs:
DBError(Execute(Database(PgDatabaseError { severity: Error, code: "42P05", message: "prepared statement \"sqlx_s_1\" already exists",

I believe this is being fixed "disable_statement_logging"

use crate::settings::Settings;
use db_core::prelude::*;

pub type BoxDB = Box<dyn MCDatabase>;

pub mod pg {
    use super::*;
    use db_sqlx_postgres::{ConnectionOptions, Fresh};
    use sqlx::postgres::PgPoolOptions;

    pub async fn get_data(settings: Option<Settings>) -> BoxDB {
        let settings = settings.unwrap_or_else(|| Settings::new().unwrap());
        let pool = settings.database.pool;
        let pool_options = PgPoolOptions::new().max_connections(pool);
        let connection_options = ConnectionOptions::Fresh(Fresh {
            pool_options,
            url: settings.database.url.clone(),
            disable_logging: !settings.debug,
        });
        let db = connection_options.connect().await.unwrap();
        db.migrate().await.unwrap();
        Box::new(db)
    }
}

However, I don't understand how to enable it. Judging by the source code, you need to change the debug = true setting for this. But it didn't work for me.

@realaravinth
Copy link
Member

I believe this is being fixed "disable_statement_logging"

Can you please explain how you arrived at this solution?

you need to change the debug = true setting for this. But it didn't work for me.

Setting debug = true in the configuration file instructs the database driver to increase verbosity while logging. I don't know if it will have any effect on the database itself.

Searching on the internet yielded results related to database drivers, which leads me to believe that this is a problem with the database driver we are using. We are not using the latest version, so I'll update it and see if it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants