@@ -133,7 +133,13 @@ public override bool Exists()
133133 {
134134 // When checking whether a database exists, pooling must be off, otherwise we may
135135 // attempt to reuse a pooled connection, which may be broken (this happened in the tests).
136- var unpooledCsb = new NpgsqlConnectionStringBuilder ( _connection . ConnectionString ) { Pooling = false } ;
136+ // If Pooling is off, but Multiplexing is on - NpgsqlConnectionStringBuilder.Validate will throw,
137+ // so we turn off Multiplexing as well.
138+ var unpooledCsb = new NpgsqlConnectionStringBuilder ( _connection . ConnectionString )
139+ {
140+ Pooling = false ,
141+ Multiplexing = false
142+ } ;
137143 using var unpooledConn = ( ( NpgsqlConnection ) _connection . DbConnection ) . CloneWith ( unpooledCsb . ToString ( ) ) ;
138144 using var _ = new TransactionScope ( TransactionScopeOption . Suppress ) ;
139145 unpooledConn . Open ( ) ;
@@ -165,7 +171,13 @@ public override async Task<bool> ExistsAsync(CancellationToken cancellationToken
165171 {
166172 // When checking whether a database exists, pooling must be off, otherwise we may
167173 // attempt to reuse a pooled connection, which may be broken (this happened in the tests).
168- var unpooledCsb = new NpgsqlConnectionStringBuilder ( _connection . ConnectionString ) { Pooling = false } ;
174+ // If Pooling is off, but Multiplexing is on - NpgsqlConnectionStringBuilder.Validate will throw,
175+ // so we turn off Multiplexing as well.
176+ var unpooledCsb = new NpgsqlConnectionStringBuilder ( _connection . ConnectionString )
177+ {
178+ Pooling = false ,
179+ Multiplexing = false
180+ } ;
169181 using var unpooledConn = ( ( NpgsqlConnection ) _connection . DbConnection ) . CloneWith ( unpooledCsb . ToString ( ) ) ;
170182 using var _ = new TransactionScope ( TransactionScopeOption . Suppress , TransactionScopeAsyncFlowOption . Enabled ) ;
171183 await unpooledConn . OpenAsync ( cancellationToken ) ;
0 commit comments