diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6451889e92..b9206d61a3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -70,8 +70,8 @@ jobs: strategy: fail-fast: false matrix: - pgVersion: [14, 15, 16, 17, 18] - name: PG ${{ matrix.pgVersion }} + pgVersion: [pg-14, pg-15, pg-16, pg-17, pg-18, oriole-17] + name: ${{ matrix.pgVersion }} runs-on: ubuntu-24.04 defaults: run: @@ -84,25 +84,25 @@ jobs: uses: ./.github/actions/setup-nix with: 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 - name: Run spec tests if: always() - run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-spec + run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-spec - name: Run observability tests if: always() - run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-observability + run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-observability - name: Run IO tests 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 if: always() - run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-big-schema -vv + run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-big-schema -vv memory: diff --git a/default.nix b/default.nix index 2161e2624c..73e59c4927 100644 --- a/default.nix +++ b/default.nix @@ -57,6 +57,10 @@ let { 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-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); } + { + name = "oriole-17"; + postgresql = pkgs.orioledb.withPackages (p: [ p.postgis p.pg_safeupdate ]); + } ]; haskellPackages = pkgs.haskell.packages."${compiler}"; diff --git a/flake.lock b/flake.lock index 3790b4d6a0..6f80c7771e 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1776949667, - "narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=", - "owner": "nixos", + "lastModified": 1778138775, + "narHash": "sha256-ovfZC/mUr4fRVIzC2g0hq9a4nyHfYSaGsK2EBFwa9b0=", + "owner": "wolfgangwalther", "repo": "nixpkgs", - "rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30", + "rev": "fb05d29caa309c72a204d19d534398dcc06fed3b", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", + "owner": "wolfgangwalther", + "ref": "orioledb-latest", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index cb5d488539..e401a2b90c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "REST API for any Postgres database"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs.url = "github:wolfgangwalther/nixpkgs/orioledb-latest"; }; nixConfig = { diff --git a/nix/tools/withTools.nix b/nix/tools/withTools.nix index 094f13b359..2e7d8976e5 100644 --- a/nix/tools/withTools.nix +++ b/nix/tools/withTools.nix @@ -14,6 +14,10 @@ let { name, postgresql }: let commandName = "postgrest-with-${name}"; + orioleOptions = + lib.optionalString + (name == "oriole-17") + " -c default_table_access_method='orioledb' -c shared_preload_libraries='orioledb'"; in checkedShellScript { @@ -80,7 +84,7 @@ let # On MacOS, it's 104 chars # See: https://serverfault.com/questions/641347/check-if-a-path-exceeds-maximum-for-unix-domain-socket - pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" " \ + pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" ${orioleOptions}" \ >> "$setuplog" log "Creating a minimally privileged $PGUSER connection role..." @@ -106,7 +110,7 @@ let log "Starting replica on $replica_host" # We set a low max_standby_streaming_delay to make the replication conflict fail faster in tests (otherwise it waits for the default 30s) - pg_ctl -D "$replica_dir" -l "$replica_dblog" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $replica_host -c log_statement=\"all\" -c max_standby_streaming_delay=\"3s\" " \ + pg_ctl -D "$replica_dir" -l "$replica_dblog" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $replica_host -c log_statement=\"all\" -c max_standby_streaming_delay=\"3s\" ${orioleOptions}" \ >> "$setuplog" >&2 echo "${commandName}: Replica enabled. You can connect to it with: psql 'postgres:///$PGDATABASE?host=$replica_host' -U postgres" diff --git a/test/io/fixtures/load.sql b/test/io/fixtures/load.sql index 2764672366..0f81bd7ea6 100644 --- a/test/io/fixtures/load.sql +++ b/test/io/fixtures/load.sql @@ -2,6 +2,7 @@ \set ON_ERROR_STOP on +\ir ../../orioledb.sql \ir database.sql \ir db_config.sql \ir roles.sql diff --git a/test/load/fixtures.sql b/test/load/fixtures.sql index 75bd6a8bb2..736c23e8a8 100644 --- a/test/load/fixtures.sql +++ b/test/load/fixtures.sql @@ -1,3 +1,5 @@ +\ir ../orioledb.sql + CREATE ROLE postgrest_test_anonymous; CREATE ROLE postgrest_test_author; GRANT postgrest_test_anonymous TO :"PGUSER"; diff --git a/test/observability/fixtures/load.sql b/test/observability/fixtures/load.sql index 135404c832..8e5ca17708 100644 --- a/test/observability/fixtures/load.sql +++ b/test/observability/fixtures/load.sql @@ -2,6 +2,7 @@ \set ON_ERROR_STOP on +\ir ../../orioledb.sql \ir database.sql \ir roles.sql \ir schema.sql diff --git a/test/orioledb.sql b/test/orioledb.sql new file mode 100644 index 0000000000..5800830031 --- /dev/null +++ b/test/orioledb.sql @@ -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 diff --git a/test/spec/fixtures/load.sql b/test/spec/fixtures/load.sql index c73f86b7b1..fed2fa1f3d 100644 --- a/test/spec/fixtures/load.sql +++ b/test/spec/fixtures/load.sql @@ -2,6 +2,7 @@ \set ON_ERROR_STOP on +\ir ../../orioledb.sql \ir database.sql \ir roles.sql \ir schema.sql