Skip to content

Commit 1e66df6

Browse files
feat: Drop support for pg 10
1 parent 872ed4e commit 1e66df6

File tree

20 files changed

+286
-369
lines changed

20 files changed

+286
-369
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
strategy:
7171
fail-fast: false
7272
matrix:
73-
pgVersion: [10, 11, 12, 13, 14, 15, 16]
73+
pgVersion: [11, 12, 13, 14, 15, 16]
7474
name: Test PG ${{ matrix.pgVersion }} (Nix)
7575
runs-on: ubuntu-latest
7676
defaults:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2020

2121
### Changed
2222
- #2052, Dropped support for PostgreSQL 9.6 - @wolfgangwalther
23+
- #2052, Dropped support for PostgreSQL 10 - @wolfgangwalther
2324

2425
### Deprecated
2526

default.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ let
6262
{ name = "postgresql-13"; postgresql = pkgs.postgresql_13.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
6363
{ name = "postgresql-12"; postgresql = pkgs.postgresql_12.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
6464
{ name = "postgresql-11"; postgresql = pkgs.postgresql_11.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
65-
{ name = "postgresql-10"; postgresql = pkgs.postgresql_10.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
6665
];
6766

6867
# Dynamic derivation for PostgREST

nix/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ The PostgREST utilities available in `nix-shell` all have names that begin with
7575
postgrest-build postgrest-test-spec
7676
postgrest-check postgrest-watch
7777
postgrest-clean postgrest-with-all
78-
postgrest-coverage postgrest-with-postgresql-10
79-
postgrest-lint postgrest-with-postgresql-11
80-
postgrest-run postgrest-with-postgresql-12
81-
postgrest-style postgrest-with-postgresql-13
82-
postgrest-style-check postgrest-with-postgresql-14
83-
postgrest-test-io
78+
postgrest-coverage postgrest-with-postgresql-11
79+
postgrest-lint postgrest-with-postgresql-12
80+
postgrest-run postgrest-with-postgresql-13
81+
postgrest-style postgrest-with-postgresql-14
82+
postgrest-style-check postgrest-with-postgresql-15
83+
postgrest-test-io postgrest-with-postgresql-16
8484
...
8585

8686
[nix-shell]$
@@ -99,12 +99,12 @@ $ nix-shell --arg memory true
9999
postgrest-build postgrest-test-spec
100100
postgrest-check postgrest-watch
101101
postgrest-clean postgrest-with-all
102-
postgrest-coverage postgrest-with-postgresql-10
103-
postgrest-lint postgrest-with-postgresql-11
104-
postgrest-run postgrest-with-postgresql-12
105-
postgrest-style postgrest-with-postgresql-13
106-
postgrest-style-check postgrest-with-postgresql-14
107-
postgrest-test-io
102+
postgrest-coverage postgrest-with-postgresql-11
103+
postgrest-lint postgrest-with-postgresql-12
104+
postgrest-run postgrest-with-postgresql-13
105+
postgrest-style postgrest-with-postgresql-14
106+
postgrest-style-check postgrest-with-postgresql-15
107+
postgrest-test-io postgrest-with-postgresql-16
108108
postgrest-test-memory
109109
...
110110

nix/overlays/postgis.nix

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,4 @@ in
1515
postgis = prev.postgresql_11.pkgs.postgis.overrideAttrs (_: postgis_3_2_3);
1616
};
1717
};
18-
postgresql_10 = prev.postgresql_10.override { this = final.postgresql_11; } // {
19-
pkgs = prev.postgresql_10.pkgs // {
20-
postgis = prev.postgresql_10.pkgs.postgis.overrideAttrs (_: postgis_3_2_3);
21-
};
22-
};
2318
}

nix/overlays/postgresql-legacy.nix

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@ self: super:
22
# Overlay that adds legacy versions of PostgreSQL that are supported by
33
# PostgREST.
44
{
5-
# PostgreSQL 10 was removed from Nixpkgs with
6-
# https://github.com/NixOS/nixpkgs/commit/aa1483114bb329fee7e1266100b8d8921ed4723f
7-
# We pin its parent commit to get the last version that was available.
8-
postgresql_10 =
9-
let
10-
rev = "79661ba7e2fb96ebefbb537458a5bbae9dc5bd1a";
11-
tarballHash = "0rn796pfn4sg90ai9fdnwmr10a2s835p1arazzgz46h6s5cxvq97";
12-
pinnedPkgs =
13-
builtins.fetchTarball {
14-
url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
15-
sha256 = tarballHash;
16-
};
17-
in
18-
(import pinnedPkgs { }).pkgs.postgresql_10;
19-
205
# PostgreSQL 11 was removed from Nixpkgs with
216
# https://github.com/NixOS/nixpkgs/commit/1220a4d4dd1a4590780a5e1c18d1333a121be366
227
# We pin its parent commit to get the last version that was available.

src/PostgREST/App.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ handleRequest AuthResult{..} conf appState authenticated prepared pgVer apiReq@A
206206

207207
(ActionInspect headersOnly, TargetDefaultSpec tSchema) -> do
208208
(planTime', iPlan) <- withTiming $ liftEither $ Plan.inspectPlan apiReq
209-
(txTime', oaiResult) <- withTiming $ runQuery roleIsoLvl mempty (Plan.ipTxmode iPlan) $ Query.openApiQuery sCache pgVer conf tSchema
209+
(txTime', oaiResult) <- withTiming $ runQuery roleIsoLvl mempty (Plan.ipTxmode iPlan) $ Query.openApiQuery sCache conf tSchema
210210
(respTime', pgrst) <- withTiming $ liftEither $ Response.openApiResponse (T.decodeUtf8 prettyVersion, docsVersion) headersOnly oaiResult conf sCache iSchema iNegotiatedByProfile
211211
return $ pgrstResponse (ServerTiming jwtTime parseTime planTime' txTime' respTime') pgrst
212212

src/PostgREST/Config/PgVersion.hs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
module PostgREST.Config.PgVersion
44
( PgVersion(..)
55
, minimumPgVersion
6-
, pgVersion109
7-
, pgVersion110
86
, pgVersion112
97
, pgVersion114
108
, pgVersion120
@@ -30,13 +28,7 @@ instance Ord PgVersion where
3028

3129
-- | Tells the minimum PostgreSQL version required by this version of PostgREST
3230
minimumPgVersion :: PgVersion
33-
minimumPgVersion = pgVersion100
34-
35-
pgVersion100 :: PgVersion
36-
pgVersion100 = PgVersion 100000 "10"
37-
38-
pgVersion109 :: PgVersion
39-
pgVersion109 = PgVersion 100009 "10.9"
31+
minimumPgVersion = pgVersion110
4032

4133
pgVersion110 :: PgVersion
4234
pgVersion110 = PgVersion 110000 "11.0"

src/PostgREST/Query.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ invokeQuery rout CallReadPlan{..} apiReq@ApiRequest{iPreferences=Preferences{..}
172172
failExceedsMaxAffectedPref (preferMaxAffected,preferHandling) resultSet
173173
pure resultSet
174174

175-
openApiQuery :: SchemaCache -> PgVersion -> AppConfig -> Schema -> DbHandler (Maybe (TablesMap, RoutineMap, Maybe Text))
176-
openApiQuery sCache pgVer AppConfig{..} tSchema =
175+
openApiQuery :: SchemaCache -> AppConfig -> Schema -> DbHandler (Maybe (TablesMap, RoutineMap, Maybe Text))
176+
openApiQuery sCache AppConfig{..} tSchema =
177177
lift $ case configOpenApiMode of
178178
OAFollowPriv -> do
179179
tableAccess <- SQL.statement [tSchema] (SchemaCache.accessibleTables configDbPreparedStatements)
180180
Just <$> ((,,)
181181
(HM.filterWithKey (\qi _ -> S.member qi tableAccess) $ SchemaCache.dbTables sCache)
182-
<$> SQL.statement tSchema (SchemaCache.accessibleFuncs pgVer configDbPreparedStatements)
182+
<$> SQL.statement tSchema (SchemaCache.accessibleFuncs configDbPreparedStatements)
183183
<*> SQL.statement tSchema (SchemaCache.schemaDescription configDbPreparedStatements))
184184
OAIgnorePriv ->
185185
Just <$> ((,,)

src/PostgREST/Query/QueryBuilder.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import Data.Maybe (fromJust)
2323
import Data.Tree (Tree (..))
2424

2525
import PostgREST.ApiRequest.Preferences (PreferResolution (..))
26-
import PostgREST.Config.PgVersion (PgVersion, pgVersion110,
27-
pgVersion130)
26+
import PostgREST.Config.PgVersion (PgVersion, pgVersion130)
2827
import PostgREST.SchemaCache.Identifiers (QualifiedIdentifier (..))
2928
import PostgREST.SchemaCache.Relationship (Cardinality (..),
3029
Junction (..),
@@ -202,9 +201,9 @@ callPlanToQuery (FunctionCall qi params args returnsScalar returnsSetOfScalar re
202201
"LATERAL " <> callIt (fmtParams prms)
203202

204203
callIt :: SQL.Snippet -> SQL.Snippet
205-
callIt argument | pgVer < pgVersion130 && pgVer >= pgVersion110 && returnsCompositeAlias = "(SELECT (" <> fromQi qi <> "(" <> argument <> ")).*) pgrst_call"
206-
| returnsScalar || returnsSetOfScalar = "(SELECT " <> fromQi qi <> "(" <> argument <> ") pgrst_scalar) pgrst_call"
207-
| otherwise = fromQi qi <> "(" <> argument <> ") pgrst_call"
204+
callIt argument | pgVer < pgVersion130 && returnsCompositeAlias = "(SELECT (" <> fromQi qi <> "(" <> argument <> ")).*) pgrst_call"
205+
| returnsScalar || returnsSetOfScalar = "(SELECT " <> fromQi qi <> "(" <> argument <> ") pgrst_scalar) pgrst_call"
206+
| otherwise = fromQi qi <> "(" <> argument <> ") pgrst_call"
208207

209208
fmtParams :: [RoutineParam] -> SQL.Snippet
210209
fmtParams prms = intercalateSnippet ", "

0 commit comments

Comments
 (0)