From b4fab68cf0087bbe7499c2b562c1bb8eba42a66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Sun, 12 Apr 2026 14:16:53 +0200 Subject: [PATCH] Add basic testing guide to README. --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index a3d3b65dd..38af67e5c 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,36 @@ Then, load the Postgres extension like so: ```SQL LOAD 'build/release/extension/postgres_scanner/postgres_scanner.duckdb_extension'; ``` + +## Testing + +Requires a running Postgres instance reachable via libpq defaults (e.g. `psql` works without extra flags). Create the test database schema: + +```bash +PGHOST=localhost PGPORT=5432 PGUSER= PGPASSWORD= ./create-postgres-tables.sh +``` + +The extension is loaded from `~/.duckdb/extensions///`, copied there on first load and not overwritten on reruns. Create a symlink so the latest build is always used: + +```bash +DUCKDB_VERSION=$(ls build/reldebug/repository/) +DUCKDB_PLATFORM=$(ls build/reldebug/repository/${DUCKDB_VERSION}/) +ln -sf "$(pwd)/build/reldebug/extension/postgres_scanner/postgres_scanner.duckdb_extension" \ + ~/.duckdb/extensions/${DUCKDB_VERSION}/${DUCKDB_PLATFORM}/postgres_scanner.duckdb_extension +``` + +Run all tests: + +```bash +POSTGRES_TEST_DATABASE_AVAILABLE=1 LOCAL_EXTENSION_REPO=./build/release/repository \ + ./build/release/test/unittest --autoloading available +``` + +Run a single test: + +```bash +POSTGRES_TEST_DATABASE_AVAILABLE=1 LOCAL_EXTENSION_REPO=./build/release/repository \ + ./build/release/test/unittest --autoloading available test/sql/storage/attach_simple.test +``` + +> **Note:** debug and release launchers and extensions should not be mixed — use `build/reldebug` consistently if building with `make reldebug`.