From e4e84e5714daca455e464cff45f444f9ce6c3c98 Mon Sep 17 00:00:00 2001 From: monacoremo Date: Sun, 4 Oct 2020 10:03:02 +0200 Subject: [PATCH] Upgrade nixpkgs and add Postgres 13 support --- .circleci/config.yml | 3 ++ default.nix | 1 + nix/nixpkgs-version.nix | 6 +-- nix/overlays/postgresql-default.nix | 2 +- .../nixpkgs-revert-ghc-bootstrap.patch | 54 ++++++++++--------- src/PostgREST/Types.hs | 3 ++ test/Feature/InsertSpec.hs | 8 ++- 7 files changed, 45 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d76ca655..eab976c70 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -230,6 +230,9 @@ jobs: - run: name: Run the spec tests against PostgreSQL 12 command: postgrest-test-spec-postgresql-12 + - run: + name: Run the spec tests against PostgreSQL 13 + command: postgrest-test-spec-postgresql-13 - run: name: Run io tests command: postgrest-test-io diff --git a/default.nix b/default.nix index 05f24637f..bb8df0cfe 100644 --- a/default.nix +++ b/default.nix @@ -44,6 +44,7 @@ let postgresqlVersions = { + postgresql-13 = pkgs.postgresql_13; postgresql-12 = pkgs.postgresql_12; postgresql-11 = pkgs.postgresql_11; postgresql-10 = pkgs.postgresql_10; diff --git a/nix/nixpkgs-version.nix b/nix/nixpkgs-version.nix index 8e4c2665c..f2a4a6624 100644 --- a/nix/nixpkgs-version.nix +++ b/nix/nixpkgs-version.nix @@ -1,6 +1,6 @@ # Pinned version of Nixpkgs, generated with nixpkgs-upgrade. { - date = "2020-09-04"; - rev = "7bc3a08d3a4c700b53a3b27f5acd149f24b931ec"; - tarballHash = "1kiz37052zsgvw7a378zg08mpbi1wk8dkgm5j6dy0x4mxvcg8ws3"; + date = "2020-10-04"; + rev = "d191ee22f0b0c91070f9f4c79210d4e398df0b93"; + tarballHash = "13fb4cgxxc47shmzbm0rawfxjnilf7r4zq1vwc0z6s3lxijl9wl9"; } diff --git a/nix/overlays/postgresql-default.nix b/nix/overlays/postgresql-default.nix index 9ae6ee263..eeb62e315 100644 --- a/nix/overlays/postgresql-default.nix +++ b/nix/overlays/postgresql-default.nix @@ -1,5 +1,5 @@ self: super: # Overlay that sets the default version of PostgreSQL. { - postgresql = super.postgresql_12; + postgresql = super.postgresql_13; } diff --git a/nix/patches/nixpkgs-revert-ghc-bootstrap.patch b/nix/patches/nixpkgs-revert-ghc-bootstrap.patch index 415cfadef..542d358b8 100644 --- a/nix/patches/nixpkgs-revert-ghc-bootstrap.patch +++ b/nix/patches/nixpkgs-revert-ghc-bootstrap.patch @@ -1,13 +1,14 @@ -From f9e4b7fd7a93ab643db0b1c84003987400bbe120 Mon Sep 17 00:00:00 2001 -From: Remo -Date: Sun, 23 Aug 2020 12:01:48 +0200 +From 9ec726b1d1a231dcff5ada065a858e9faaa7463f Mon Sep 17 00:00:00 2001 +From: monacoremo +Date: Sun, 4 Oct 2020 16:16:04 +0200 Subject: [PATCH] Revert "ghc: 8.6.3-binary -> 8.6.5-binary" This reverts commit 3c7ef6bcd85e3e133ac6f2ab5e238934d56d902e. + --- - .../{8.6.5-binary.nix => 8.6.3-binary.nix} | 13 +++++----- - pkgs/top-level/haskell-packages.nix | 25 ++++++++----------- - 2 files changed, 16 insertions(+), 22 deletions(-) + .../{8.6.5-binary.nix => 8.6.3-binary.nix} | 13 ++++++------ + pkgs/top-level/haskell-packages.nix | 20 +++++++++---------- + 2 files changed, 16 insertions(+), 17 deletions(-) rename pkgs/development/compilers/ghc/{8.6.5-binary.nix => 8.6.3-binary.nix} (94%) diff --git a/pkgs/development/compilers/ghc/8.6.5-binary.nix b/pkgs/development/compilers/ghc/8.6.3-binary.nix @@ -19,13 +20,13 @@ index 41af279e83f..5853a470efc 100644 +++ b/pkgs/development/compilers/ghc/8.6.3-binary.nix @@ -27,19 +27,18 @@ let in - + stdenv.mkDerivation rec { - version = "8.6.5"; + version = "8.6.3"; - + name = "ghc-${version}-binary"; - + - # https://downloads.haskell.org/~ghc/8.6.5/ src = fetchurl ({ i686-linux = { @@ -52,29 +53,29 @@ index 41af279e83f..5853a470efc 100644 }.${stdenv.hostPlatform.system} or (throw "cannot bootstrap GHC on this platform")); diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix -index 3e85109527e..388210b83fb 100644 +index 693f8fe8276..034294b7264 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix -@@ -4,7 +4,8 @@ let +@@ -4,8 +4,8 @@ let # These are attributes in compiler and packages that don't support integer-simple. integerSimpleExcludes = [ "ghc822Binary" - "ghc865Binary" + "ghc8102Binary" + "ghc863Binary" -+ "ghc844" "ghcjs" "ghcjs86" "integer-simple" -@@ -47,7 +48,7 @@ in { - +@@ -48,7 +48,7 @@ in { + ghc822Binary = callPackage ../development/compilers/ghc/8.2.2-binary.nix { }; - + - ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix { }; + ghc863Binary = callPackage ../development/compilers/ghc/8.6.3-binary.nix { }; - - ghc865 = callPackage ../development/compilers/ghc/8.6.5.nix { - bootPkgs = packages.ghc822Binary; -@@ -56,31 +57,25 @@ in { + + ghc8102Binary = callPackage ../development/compilers/ghc/8.10.2-binary.nix { + llvmPackages = pkgs.llvmPackages_9; +@@ -61,31 +61,31 @@ in { llvmPackages = pkgs.llvmPackages_6; }; ghc882 = callPackage ../development/compilers/ghc/8.8.2.nix { @@ -100,17 +101,18 @@ index 3e85109527e..388210b83fb 100644 }; ghc8101 = callPackage ../development/compilers/ghc/8.10.1.nix { - bootPkgs = packages.ghc865Binary; -- inherit (buildPackages.python3Packages) sphinx; -- buildLlvmPackages = buildPackages.llvmPackages_9; -- llvmPackages = pkgs.llvmPackages_9; -- }; -- ghc8102 = callPackage ../development/compilers/ghc/8.10.2.nix { ++ bootPkgs = packages.ghc863Binary; + inherit (buildPackages.python3Packages) sphinx; + buildLlvmPackages = buildPackages.llvmPackages_9; + llvmPackages = pkgs.llvmPackages_9; + }; + ghc8102 = callPackage ../development/compilers/ghc/8.10.2.nix { - bootPkgs = packages.ghc865Binary; + bootPkgs = packages.ghc863Binary; inherit (buildPackages.python3Packages) sphinx; buildLlvmPackages = buildPackages.llvmPackages_9; llvmPackages = pkgs.llvmPackages_9; -@@ -133,9 +128,9 @@ in { +@@ -144,9 +144,9 @@ in { compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { }; packageSetConfig = bootstrapPackageSet; }; @@ -123,6 +125,6 @@ index 3e85109527e..388210b83fb 100644 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.6.x.nix { }; packageSetConfig = bootstrapPackageSet; }; --- +-- 2.28.0 diff --git a/src/PostgREST/Types.hs b/src/PostgREST/Types.hs index 0a74bffba..eaa5ac44d 100644 --- a/src/PostgREST/Types.hs +++ b/src/PostgREST/Types.hs @@ -521,6 +521,9 @@ pgVersion114 = PgVersion 110004 "11.4" pgVersion121 :: PgVersion pgVersion121 = PgVersion 120001 "12.1" +pgVersion130 :: PgVersion +pgVersion130 = PgVersion 130000 "13.0" + sourceCTEName :: SqlFragment sourceCTEName = "pgrst_source" diff --git a/test/Feature/InsertSpec.hs b/test/Feature/InsertSpec.hs index 01ce8fcf7..53f7c8dc1 100644 --- a/test/Feature/InsertSpec.hs +++ b/test/Feature/InsertSpec.hs @@ -15,7 +15,7 @@ import Test.Hspec.Wai import Test.Hspec.Wai.JSON import Text.Heredoc -import PostgREST.Types (PgVersion, pgVersion112) +import PostgREST.Types (PgVersion, pgVersion112, pgVersion130) import Protolude hiding (get) import SpecHelper @@ -152,7 +152,11 @@ spec actualPgVersion = do it "fails with 400 and error" $ post "/simple_pk" [json| { "extra":"foo"} |] `shouldRespondWith` - [json|{"hint":null,"details":"Failing row contains (null, foo).","code":"23502","message":"null value in column \"k\" violates not-null constraint"}|] + (if actualPgVersion >= pgVersion130 then + [json|{"hint":null,"details":"Failing row contains (null, foo).","code":"23502","message":"null value in column \"k\" of relation \"simple_pk\" violates not-null constraint"}|] + else + [json|{"hint":null,"details":"Failing row contains (null, foo).","code":"23502","message":"null value in column \"k\" violates not-null constraint"}|] + ) { matchStatus = 400 , matchHeaders = [matchContentTypeJson] }