Skip to content

Commit

Permalink
Drop support for postgres 9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangwalther committed Oct 14, 2020
1 parent f5331d1 commit b9ed972
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 49 deletions.
5 changes: 1 addition & 4 deletions .circleci/config.yml
Expand Up @@ -31,7 +31,7 @@ jobs:
- image: circleci/buildpack-deps:trusty
environment:
- PGHOST=localhost
- image: circleci/postgres:9.4
- image: circleci/postgres:9.5
environment:
- POSTGRES_USER=circleci
- POSTGRES_DB=circleci
Expand Down Expand Up @@ -183,9 +183,6 @@ jobs:
- run:
name: Install testing scripts
command: nix-env -f default.nix -iA tests tests.ioTests tests.memoryTests
- run:
name: Run the spec tests against PostgreSQL 9.4
command: postgrest-test-spec-postgresql-9.4
- run:
name: Run the spec tests against PostgreSQL 9.5
command: postgrest-test-spec-postgresql-9.5
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #1475, Location header for POST request is only included when PK is available on the table (#1461) - @wolfgangwalther
- #1560, Volatile RPC called with GET now returns 405 Method not Allowed instead of 500 - @wolfgangwalther
- #1604, Change the default logging level to `log-level=error`. Only requests with a status greater or equal than 500 will be logged. If you wish to go back to the previous behaviour and log all the requests, use `log-level=info` - @steve-chavez
- #1617, Dropped support for PostgreSQL 9.4 - @wolfgangwalther

## [7.0.1] - 2020-05-18

Expand Down
2 changes: 0 additions & 2 deletions default.nix
Expand Up @@ -32,7 +32,6 @@ let
overlays =
[
allOverlays.postgresql-default
allOverlays.postgresql-legacy
allOverlays.gitignore
allOverlays.ghr
(allOverlays.haskell-packages { inherit compiler; })
Expand All @@ -50,7 +49,6 @@ let
postgresql-10 = pkgs.postgresql_10;
"postgresql-9.6" = pkgs.postgresql_9_6;
"postgresql-9.5" = pkgs.postgresql_9_5;
"postgresql-9.4" = pkgs.postgresql_9_4;
};

patches =
Expand Down
4 changes: 2 additions & 2 deletions nix/README.md
Expand Up @@ -70,7 +70,7 @@ The PostgREST utilities available in `nix-shell` all have names that begin with
[nix-shell]$ postgrest-<tab>
postgrest-lint postgrest-test-spec-postgresql-11
postgrest-style postgrest-test-spec-postgresql-12
postgrest-style-check postgrest-test-spec-postgresql-9.4
postgrest-style-check postgrest-test-spec-postgresql-13
postgrest-test-spec postgrest-test-spec-postgresql-9.5
postgrest-test-spec-all postgrest-test-spec-postgresql-9.6
postgrest-test-spec-postgresql-10
Expand All @@ -91,7 +91,7 @@ $ nix-shell --arg ioTests true
postgrest-lint postgrest-test-spec-postgresql-10
postgrest-style postgrest-test-spec-postgresql-11
postgrest-style-check postgrest-test-spec-postgresql-12
postgrest-test-io postgrest-test-spec-postgresql-9.4
postgrest-test-io postgrest-test-spec-postgresql-13
postgrest-test-spec postgrest-test-spec-postgresql-9.5
postgrest-test-spec-all postgrest-test-spec-postgresql-9.6
Expand Down
1 change: 0 additions & 1 deletion nix/overlays/default.nix
Expand Up @@ -3,5 +3,4 @@
ghr = import ./ghr;
haskell-packages = import ./haskell-packages.nix;
postgresql-default = import ./postgresql-default.nix;
postgresql-legacy = import ./postgresql-legacy.nix;
}
20 changes: 0 additions & 20 deletions nix/overlays/postgresql-legacy.nix

This file was deleted.

7 changes: 2 additions & 5 deletions src/PostgREST/Types.hs
Expand Up @@ -385,7 +385,7 @@ data LogicTree = Expr Bool LogicOperator [LogicTree] | Stmnt Filter deriving (Sh

type FieldName = Text
{-|
Json path operations as specified in https://www.postgresql.org/docs/9.4/static/functions-json.html
Json path operations as specified in https://www.postgresql.org/docs/current/static/functions-json.html
-}
type JsonPath = [JsonOperation]
-- | Represents the single arrow `->` or double arrow `->>` operators
Expand Down Expand Up @@ -492,10 +492,7 @@ instance Ord PgVersion where

-- | Tells the minimum PostgreSQL version required by this version of PostgREST
minimumPgVersion :: PgVersion
minimumPgVersion = pgVersion94

pgVersion94 :: PgVersion
pgVersion94 = PgVersion 90400 "9.4"
minimumPgVersion = pgVersion95

pgVersion95 :: PgVersion
pgVersion95 = PgVersion 90500 "9.5"
Expand Down
12 changes: 3 additions & 9 deletions test/Feature/RpcSpec.hs
Expand Up @@ -12,8 +12,7 @@ import Test.Hspec.Wai.JSON
import Text.Heredoc

import PostgREST.Types (PgVersion, pgVersion100, pgVersion109,
pgVersion110, pgVersion112, pgVersion114,
pgVersion95)
pgVersion110, pgVersion112, pgVersion114)
import Protolude hiding (get)
import SpecHelper

Expand Down Expand Up @@ -101,16 +100,11 @@ spec actualPgVersion =
get "/rpc/sayhello?any_arg=value" `shouldRespondWith` 404
it "should not ignore unknown args and fail with 404" $
get "/rpc/add_them?a=1&b=2&smthelse=blabla" `shouldRespondWith`
let
message :: Text
message
| actualPgVersion < pgVersion95 = "function test.add_them(a := integer, b := integer, smthelse := text) does not exist"
| otherwise = "function test.add_them(a => integer, b => integer, smthelse => text) does not exist"
in [json| {
[json| {
"code": "42883",
"details": null,
"hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
"message": #{message} } |]
"message": "function test.add_them(a => integer, b => integer, smthelse => text) does not exist" } |]
{ matchStatus = 404
, matchHeaders = [matchContentTypeJson]
}
Expand Down
10 changes: 4 additions & 6 deletions test/Main.hs
Expand Up @@ -15,7 +15,7 @@ import Test.Hspec
import PostgREST.App (postgrest)
import PostgREST.Config (AppConfig (..))
import PostgREST.DbStructure (getDbStructure, getPgVersion)
import PostgREST.Types (LogLevel (..), pgVersion95, pgVersion96)
import PostgREST.Types (LogLevel (..), pgVersion96)
import Protolude hiding (toList, toS)
import Protolude.Conv (toS)
import SpecHelper
Expand Down Expand Up @@ -98,10 +98,6 @@ main = do
analyzeTable testDbConn "items"
analyzeTable testDbConn "child_entities"

extraSpecs =
[("Feature.UpsertSpec", Feature.UpsertSpec.spec) | actualPgVersion >= pgVersion95] ++
[("Feature.PgVersion95Spec", Feature.PgVersion95Spec.spec) | actualPgVersion >= pgVersion95]

specs = uncurry describe <$> [
("Feature.AuthSpec" , Feature.AuthSpec.spec actualPgVersion)
, ("Feature.RawOutputTypesSpec" , Feature.RawOutputTypesSpec.spec)
Expand All @@ -113,7 +109,9 @@ main = do
, ("Feature.RpcSpec" , Feature.RpcSpec.spec actualPgVersion)
, ("Feature.StructureSpec" , Feature.StructureSpec.spec)
, ("Feature.AndOrParamsSpec" , Feature.AndOrParamsSpec.spec actualPgVersion)
] ++ extraSpecs
, ("Feature.UpsertSpec" , Feature.UpsertSpec.spec)
, ("Feature.PgVersion95Spec" , Feature.PgVersion95Spec.spec)
]

mutSpecs = uncurry describe <$> [
("Feature.DeleteSpec" , Feature.DeleteSpec.spec)
Expand Down

0 comments on commit b9ed972

Please sign in to comment.