Skip to content

Commit 64582d1

Browse files
committed
Fix schema search path
1 parent 9deef4f commit 64582d1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/driver/sqlx_postgres.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,18 @@ impl SqlxPostgresConnector {
7878
}
7979
let set_search_path_sql = options.schema_search_path.as_ref().map(|schema| {
8080
let mut string = "SET search_path = ".to_owned();
81-
for (i, schema) in schema.split(',').enumerate() {
82-
if i > 0 {
83-
write!(&mut string, ",").unwrap();
84-
}
85-
if schema.starts_with('"') {
86-
write!(&mut string, "{schema}").unwrap();
87-
} else {
88-
write!(&mut string, "\"{schema}\"").unwrap();
81+
if schema.starts_with('"') {
82+
write!(&mut string, "{schema}").unwrap();
83+
} else {
84+
for (i, schema) in schema.split(',').enumerate() {
85+
if i > 0 {
86+
write!(&mut string, ",").unwrap();
87+
}
88+
if schema.starts_with('"') {
89+
write!(&mut string, "{schema}").unwrap();
90+
} else {
91+
write!(&mut string, "\"{schema}\"").unwrap();
92+
}
8993
}
9094
}
9195
string

0 commit comments

Comments
 (0)