nix: add postgrest-with-oriole-18

This commit is contained in:
Wolfgang Walther
2026-08-02 14:51:50 +00:00
parent 549ab36c30
commit f84c44dafa
12 changed files with 46 additions and 22 deletions
+7 -7
View File
@@ -75,8 +75,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
# Latest version is tested via `coverage` above. # Latest version is tested via `coverage` above.
pgVersion: [14, 15, 16, 17, 18] pgVersion: [pg-14, pg-15, pg-16, pg-17, oriole-18, pg-18]
name: PG ${{ matrix.pgVersion }} name: ${{ matrix.pgVersion }}
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
defaults: defaults:
run: run:
@@ -89,25 +89,25 @@ jobs:
uses: ./.github/actions/setup-nix uses: ./.github/actions/setup-nix
with: with:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
tools: tests.testSpec.bin tests.testObservability.bin tests.testIO.bin tests.testBigSchema.bin withTools.pg-${{ matrix.pgVersion }}.bin cabalTools.update.bin tools: tests.testSpec.bin tests.testObservability.bin tests.testIO.bin tests.testBigSchema.bin withTools.${{ matrix.pgVersion }}.bin cabalTools.update.bin
- run: postgrest-cabal-update - run: postgrest-cabal-update
- name: Run spec tests - name: Run spec tests
if: always() if: always()
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-spec run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-spec
- name: Run observability tests - name: Run observability tests
if: always() if: always()
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-observability run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-observability
- name: Run IO tests - name: Run IO tests
if: always() if: always()
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-io -vv run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-io -vv
- name: Run IO tests on a big schema - name: Run IO tests on a big schema
if: always() if: always()
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-big-schema -vv run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
memory: memory:
+8
View File
@@ -58,6 +58,14 @@ let
{ name = "pg-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); } { name = "pg-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
{ name = "pg-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); } { name = "pg-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
{ name = "pg-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); } { name = "pg-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
{
name = "oriole-18";
postgresql = pkgs.orioledb.withPackages (p: [ p.postgis p.pg_safeupdate ]);
config = "
default_table_access_method = 'orioledb'
shared_preload_libraries = 'orioledb, pg_stat_statements'
";
}
]; ];
haskellPackages = pkgs.haskell.packages."${compiler}"; haskellPackages = pkgs.haskell.packages."${compiler}";
+3
View File
@@ -31,3 +31,6 @@ A minimal example could look like this:
} }
This will expose the PostgREST server on localhost on the NixOS machine and allow anonymous access. This will expose the PostgREST server on localhost on the NixOS machine and allow anonymous access.
.. tip::
NixOS also allows to quickly spin up different PostgreSQL versions or even forks this way. For example, to test the current beta version of `OrioleDB <https://www.orioledb.com>`_, use ``services.postgresql.package = pkgs.orioledb``.
+3 -3
View File
@@ -11,15 +11,15 @@
}: }:
let let
withTmpDb = withTmpDb =
{ name, postgresql }: { name, postgresql, config ? "" }:
let let
commandName = "postgrest-with-${name}"; commandName = "postgrest-with-${name}";
postgresqlConf = writeText "postgresql.conf" " postgresqlConf = writeText "postgresql.conf" ("
autovacuum = false autovacuum = false
listen_addresses = '' listen_addresses = ''
log_statement = all log_statement = all
shared_preload_libraries=pg_stat_statements shared_preload_libraries=pg_stat_statements
"; " + config);
in in
checkedShellScript checkedShellScript
{ {
+2
View File
@@ -1,3 +1,5 @@
\ir ../../orioledb.sql
/* /*
This is a 2018 version of the apflora schema https://github.com/barbalex/apf2/tree/master/sql/apflora - latest version likely has differing contents This is a 2018 version of the apflora schema https://github.com/barbalex/apf2/tree/master/sql/apflora - latest version likely has differing contents
+1
View File
@@ -2,6 +2,7 @@
\set ON_ERROR_STOP on \set ON_ERROR_STOP on
\ir ../../orioledb.sql
\ir database.sql \ir database.sql
\ir db_config.sql \ir db_config.sql
\ir roles.sql \ir roles.sql
+2
View File
@@ -1,3 +1,5 @@
\ir ../orioledb.sql
CREATE ROLE postgrest_test_anonymous; CREATE ROLE postgrest_test_anonymous;
CREATE ROLE postgrest_test_author; CREATE ROLE postgrest_test_author;
GRANT postgrest_test_anonymous TO :"PGUSER"; GRANT postgrest_test_anonymous TO :"PGUSER";
+1
View File
@@ -2,6 +2,7 @@
\set ON_ERROR_STOP on \set ON_ERROR_STOP on
\ir ../../orioledb.sql
\ir database.sql \ir database.sql
\ir roles.sql \ir roles.sql
\ir schema.sql \ir schema.sql
+6
View File
@@ -0,0 +1,6 @@
SELECT EXISTS (SELECT * FROM pg_available_extensions WHERE name = 'orioledb') AS is_orioledb_available \gset
\if :is_orioledb_available
CREATE SCHEMA orioledb;
CREATE EXTENSION orioledb WITH SCHEMA orioledb;
\endif
@@ -76,7 +76,7 @@ spec withConfig = withConfig baseCfg $
} }
it "only affects the source table rows if his direct embedding is an inner join" $ do it "only affects the source table rows if his direct embedding is an inner join" $ do
get "/tasks?select=id,projects(id,clients!inner(id))&projects.clients.id=eq.2" `shouldRespondWith` get "/tasks?select=id,projects(id,clients!inner(id))&projects.clients.id=eq.2&order=id" `shouldRespondWith`
[json|[ [json|[
{"id":1,"projects":null}, {"id":1,"projects":null},
{"id":2,"projects":null}, {"id":2,"projects":null},
+11 -11
View File
@@ -34,7 +34,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 1.11 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for a single filter on a view" $ do it "outputs the total cost for a single filter on a view" $ do
r <- request methodGet "/projects_view?id=gt.2" r <- request methodGet "/projects_view?id=gt.2"
@@ -47,7 +47,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
liftIO $ do liftIO $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 1.1 totalCost `shouldSatisfy` (> 0)
it "outputs blocks info when using the buffers option" $ do it "outputs blocks info when using the buffers option" $ do
r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; options=buffers") "" r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; options=buffers") ""
@@ -139,7 +139,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 0.06 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for an update" $ do it "outputs the total cost for an update" $ do
r <- request methodPatch "/projects?id=eq.3" r <- request methodPatch "/projects?id=eq.3"
@@ -153,7 +153,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 1.13 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for a delete" $ do it "outputs the total cost for a delete" $ do
r <- request methodDelete "/projects?id=in.(1,2,3)" r <- request methodDelete "/projects?id=in.(1,2,3)"
@@ -167,7 +167,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 1.16 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for a single upsert" $ do it "outputs the total cost for a single upsert" $ do
r <- request methodPut "/tiobe_pls?name=eq.Go" r <- request methodPut "/tiobe_pls?name=eq.Go"
@@ -182,7 +182,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 3.55 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for 2 upserts" $ do it "outputs the total cost for 2 upserts" $ do
r <- request methodPost "/tiobe_pls" r <- request methodPost "/tiobe_pls"
@@ -197,7 +197,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 5.53 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for an upsert with 10 rows" $ do it "outputs the total cost for an upsert with 10 rows" $ do
r <- request methodPost "/tiobe_pls" r <- request methodPost "/tiobe_pls"
@@ -211,7 +211,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
liftIO $ do liftIO $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 5.53 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for an upsert with 100 rows" $ do it "outputs the total cost for an upsert with 100 rows" $ do
r <- request methodPost "/tiobe_pls" r <- request methodPost "/tiobe_pls"
@@ -225,7 +225,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
liftIO $ do liftIO $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 5.53 totalCost `shouldSatisfy` (> 0)
it "outputs the total cost for an upsert with 1000 rows" $ do it "outputs the total cost for an upsert with 1000 rows" $ do
r <- request methodPost "/tiobe_pls" r <- request methodPost "/tiobe_pls"
@@ -239,7 +239,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
liftIO $ do liftIO $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 5.53 totalCost `shouldSatisfy` (> 0)
it "outputs the plan for application/vnd.pgrst.object" $ do it "outputs the plan for application/vnd.pgrst.object" $ do
r <- request methodDelete "/projects?id=eq.6" r <- request methodDelete "/projects?id=eq.6"
@@ -266,7 +266,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8") resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
resHeaders `shouldSatisfy` notZeroContentLength resHeaders `shouldSatisfy` notZeroContentLength
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" } resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
totalCost `shouldBe` 68.56 totalCost `shouldSatisfy` (> 0)
describe "text format" $ do describe "text format" $ do
it "outputs the total cost for a function call" $ do it "outputs the total cost for a function call" $ do
+1
View File
@@ -2,6 +2,7 @@
\set ON_ERROR_STOP on \set ON_ERROR_STOP on
\ir ../../orioledb.sql
\ir database.sql \ir database.sql
\ir roles.sql \ir roles.sql
\ir schema.sql \ir schema.sql