Merge pull request #645 from vkartaviy/fix/embedded-postgres-utf8

fix: ensure embedded PostgreSQL databases use UTF-8 encoding
This commit is contained in:
Dotta
2026-03-12 14:15:58 -05:00
committed by GitHub
4 changed files with 4 additions and 1 deletions

View File

@@ -514,6 +514,7 @@ async function ensureEmbeddedPostgres(dataDir: string, preferredPort: number): P
password: "paperclip",
port,
persistent: true,
initdbFlags: ["--encoding=UTF8", "--locale=C"],
onLog: () => {},
onError: () => {},
});

View File

@@ -730,7 +730,7 @@ export async function ensurePostgresDatabase(
`;
if (existing.length > 0) return "exists";
await sql.unsafe(`create database "${databaseName}"`);
await sql.unsafe(`create database "${databaseName}" encoding 'UTF8' lc_collate 'C' lc_ctype 'C' template template0`);
return "created";
} finally {
await sql.end();

View File

@@ -96,6 +96,7 @@ async function ensureEmbeddedPostgresConnection(
password: "paperclip",
port: preferredPort,
persistent: true,
initdbFlags: ["--encoding=UTF8", "--locale=C"],
onLog: () => {},
onError: () => {},
});

View File

@@ -334,6 +334,7 @@ export async function startServer(): Promise<StartedServer> {
password: "paperclip",
port,
persistent: true,
initdbFlags: ["--encoding=UTF8", "--locale=C"],
onLog: appendEmbeddedPostgresLog,
onError: appendEmbeddedPostgresLog,
});