Skip to content

Commit 28c3325

Browse files
committed
test: set LC_COLLATE (TC-3070)
Signed-off-by: mrizzi <[email protected]> Assisted-by: Claude Code
1 parent 6e990fb commit 28c3325

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

common/db/src/embedded.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use anyhow::Context;
22
use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
33
use std::{
4-
env,
54
path::{Path, PathBuf},
65
pin::Pin,
76
};
@@ -25,13 +24,6 @@ pub fn default_settings() -> anyhow::Result<Settings> {
2524

2625
/// Create a new, embedded database instance
2726
pub async fn create() -> anyhow::Result<(Database, PostgreSQL)> {
28-
// This is required because postgresql_embedded doesn't expose initdb parameters.
29-
// LC_COLLATE="C" ensures deterministic, byte-order sorting that matches Rust's string comparison,
30-
// making tests portable across different system locales.
31-
// This affects only the embedded test database, not production databases.
32-
unsafe {
33-
env::set_var("LC_COLLATE", "C");
34-
}
3527
create_for(default_settings()?, Default::default()).await
3628
}
3729

common/db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a> Database<'a> {
5555

5656
db.execute(Statement::from_string(
5757
db.get_database_backend(),
58-
format!("CREATE DATABASE \"{}\";", database.name),
58+
format!("CREATE DATABASE \"{}\" WITH LC_COLLATE='C';", database.name),
5959
))
6060
.await?;
6161
db.close().await?;

0 commit comments

Comments
 (0)