File tree Expand file tree Collapse file tree 2 files changed +1
-9
lines changed Expand file tree Collapse file tree 2 files changed +1
-9
lines changed Original file line number Diff line number Diff line change 11use anyhow:: Context ;
22use postgresql_embedded:: { PostgreSQL , Settings , VersionReq } ;
33use 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
2726pub 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
Original file line number Diff line number Diff 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 ?;
You can’t perform that action at this time.
0 commit comments