diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a63a21603..f523769da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - This avoids the creation of single-use prepared statements, which should slightly improve performance - This allows multiple statements in a single call to sqlx::query in MySQL - In MySQL, fix "zero dates" being recognized as NULL only when transmitted as binary, not as text + - In postgres, randomize the initial prepared statement name to avoid collisions when multiple network connections are initiated in parallel and end up using the same final database tcp connection. This can happen when using a connection pooler in front of the database. ## 0.6.17 diff --git a/sqlx-core/src/postgres/connection/establish.rs b/sqlx-core/src/postgres/connection/establish.rs index cd163c5039..ddcc270dcc 100644 --- a/sqlx-core/src/postgres/connection/establish.rs +++ b/sqlx-core/src/postgres/connection/establish.rs @@ -144,7 +144,7 @@ impl PgConnection { transaction_status, transaction_depth: 0, pending_ready_for_query_count: 0, - next_statement_id: Oid(1), + next_statement_id: Oid(rand::random()), cache_statement: StatementCache::new(options.statement_cache_capacity), cache_type_oid: HashMap::new(), cache_type_info: HashMap::new(),