PostgreSQL helpers for Clojure: environment- and .pgpass-aware connection specs, HikariCP pooling, and next.jdbc type coercion for JSON/JSONB, arrays, inet, and PostGIS geometry.
The library is split into three artifacts so you only pull what you use. Core has no PostGIS or AWS dependencies.
| Artifact | For |
|---|---|
net.clojars.savya/psql-clj | connection specs, pooling, json/jsonb, arrays, inet, enums |
net.clojars.savya/psql-clj-gis | PostGIS geometry + geography (pulls postgis-jdbc) |
net.clojars.savya/psql-clj-aws | RDS/Aurora IAM authentication (pulls the AWS SDK) |
deps.edn:
net.clojars.savya/psql-clj {:mvn/version "2.0.1"}
net.clojars.savya/psql-clj-gis {:mvn/version "2.0.0"} ;; optional, for PostGIS
net.clojars.savya/psql-clj-aws {:mvn/version "2.0.0"} ;; optional, for RDS IAM auth
Leiningen:
[net.clojars.savya/psql-clj "2.0.1"]
[net.clojars.savya/psql-clj-gis "2.0.0"] ;; optional, for PostGIS
[net.clojars.savya/psql-clj-aws "2.0.0"] ;; optional, for RDS IAM auth
Core is at the repo root; the companions live under modules/gis and
modules/aws and depend on core, so install core locally first.
clojure -M:test && clojure -T:build jar # core (root)
(cd modules/gis && clojure -M:test && clojure -T:build jar) # PostGIS companion
(cd modules/aws && clojure -M:test && clojure -T:build jar) # AWS companion
clojure -M:1.10:test # repeat with :1.11 and :1.12
clojure -T:build deploy # publish core to Clojars
(cd modules/gis && clojure -T:build deploy) # publish gis companion
(cd modules/aws && clojure -T:build deploy) # publish aws companion
The :integration suites (core and gis) read the standard PG* variables. A
quick local PostGIS:
docker run -d -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=psql_clj_test \
-p 5432:5432 postgis/postgis:16-3.4
export PGHOST=localhost PGUSER=postgres PGPASSWORD=postgres PGDATABASE=psql_clj_test
clojure -M:test --focus-meta :integration # core
(cd modules/gis && clojure -M:test --focus-meta :integration) # gis
Copyright © 2014, Remod Oy. All rights reserved.
Maintenance fork (2026) by Savyasachi. Original project: https://github.com/remodoy/clj-postgresql.
Distributed under the BSD 2-Clause License. See LICENSE.
Can you improve this documentation? These fine people already did:
Juho Juopperi, Savyasachi, Søren Sjørup, Phil Jackson, Wulf, TKffTK, Prof Gra & DanEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |