Skip to content

Commit 46113ac

Browse files
committed
Fix transaction config query generation
Closes #187
1 parent 7435547 commit 46113ac

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl ConfigInternals for Config {
8888
}
8989

9090
if let Some(read_only) = self.read_only {
91-
if first {
91+
if !first {
9292
s.push(',');
9393
}
9494
if read_only {
@@ -100,7 +100,7 @@ impl ConfigInternals for Config {
100100
}
101101

102102
if let Some(deferrable) = self.deferrable {
103-
if first {
103+
if !first {
104104
s.push(',');
105105
}
106106
if deferrable {

tests/test.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,13 @@ fn transaction_config() {
10391039
conn.set_transaction_config(&config).unwrap();
10401040
}
10411041

1042+
#[test]
1043+
fn transaction_config_one_setting() {
1044+
let conn = Connection::connect("postgres://postgres@localhost", SslMode::None).unwrap();
1045+
conn.set_transaction_config(&transaction::Config::new().read_only(true)).unwrap();
1046+
conn.set_transaction_config(&transaction::Config::new().deferrable(true)).unwrap();
1047+
}
1048+
10421049
#[test]
10431050
fn transaction_with() {
10441051
let conn = Connection::connect("postgres://postgres@localhost", SslMode::None).unwrap();

0 commit comments

Comments
 (0)