Re-enable pglite after pglite-oxide v0.4.1 fixes error handling.

This commit is contained in:
Sebastian Jeltsch
2026-05-08 11:16:04 +02:00
parent f5da3ef9f1
commit 83f230942c
6 changed files with 1704 additions and 207 deletions
Generated
+1693 -177
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -128,7 +128,7 @@ axum-test = "20.0.0"
criterion = { version = "0.8", features = ["html_reports", "async_tokio"] }
env_logger = { workspace = true }
indoc = "2.0.5"
pglite-oxide = "0.3.0"
pglite-oxide = "0.4.1"
quoted_printable = "0.5.1"
rcgen = "0.14.1"
schemars = "1.0.0"
+8 -3
View File
@@ -1,12 +1,17 @@
CREATE OR REPLACE FUNCTION UNIXEPOCH() RETURNS INTEGER AS $$
-- PG before v18 may not provide `uuidv4()`, thus add an impl.
CREATE FUNCTION uuidv4() RETURNS UUID AS $$
BEGIN
RETURN gen_random_uuid();
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION UNIXEPOCH() RETURNS INT8 AS $$
BEGIN
RETURN EXTRACT(EPOCH FROM CURRENT_TIMESTAMP);
END;
$$ LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS _user (
-- We only check `is_uuid` rather than `is_uuid_v4` to preserve user
-- previously created as uuiv7.
id UUID PRIMARY KEY NOT NULL DEFAULT (uuidv4()),
email TEXT NOT NULL,
password_hash TEXT DEFAULT '' NOT NULL,
+1 -1
View File
@@ -523,7 +523,7 @@ pub async fn test_state(options: Option<TestStateOptions>) -> anyhow::Result<App
tokio::fs::create_dir_all(temp_dir.child("uploads")).await?;
let data_dir = DataDir(temp_dir.path().to_path_buf());
let use_pglite = false;
let use_pglite = true;
let (pg_uri, db) = if use_pglite {
// Start PgLite.
let tcp = false;
-24
View File
@@ -557,27 +557,3 @@ pub(crate) fn connect_rusqlite_without_default_extensions_and_schemas(
}
const PREPARED_STATEMENT_CACHE_CAPACITY: usize = 256;
#[cfg(all(test, feature = "pg"))]
mod tests {
use pglite_oxide::PgliteServer;
use trailbase_sqlite::Connection;
#[tokio::test]
async fn generic_connection_w_pg_test() {
let db = PgliteServer::temporary_tcp().unwrap();
let pg_uri = db.connection_uri();
println!("Started PgLite: {pg_uri}");
let conn = Connection::pg_with_opts(trailbase_sqlite::generic::PgOptions {
connection: trailbase_sqlite::generic::PgConnection::Uri(pg_uri),
num_threads: Some(1),
})
.unwrap();
// IMPORTANT: PgLite only handles a single concurrent connection.
assert_eq!(1, conn.threads());
conn.read_query_rows("SELECT 5", ()).await.unwrap();
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ env_logger.workspace = true
futures-util = { workspace = true }
glob = "0.3.3"
itertools = "0.14.0"
pglite-oxide = { version ="0.3.0" }
pglite-oxide = { version ="0.4.1" }
rand = { workspace = true }
tempfile = "3.19.1"
uuid = { workspace = true }