Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d10cd37
prepare for 0.6
phadej Sep 24, 2018
a9a13ec
Add changelog for 0.6
phadej Sep 25, 2018
5af199a
Add 8.6.1 job
phadej Sep 25, 2018
1a70d75
Add Vector query
phadej Oct 15, 2018
404ab1a
Use tight upper bound on Only (so instances don't leak)
phadej Oct 16, 2018
577e20b
Explain breaking change
phadej Oct 16, 2018
f9315c4
Merge pull request #1 from phadej/prepare-0.6
phadej Oct 16, 2018
cc6808d
Update maintainer
phadej Oct 16, 2018
1938872
fromJSONField: Include JSONPath on JSON parse errors
sol Nov 23, 2018
466c469
Merge pull request #2 from sol/better-json-errors
phadej Nov 28, 2018
b02bcf7
Mention GHC generics support in documentation (#6)
Gabriella439 Feb 7, 2019
9104383
Don't use TemplateHaskell in the library itself
phadej Jan 22, 2019
3389f02
Regenerate .travis.yml
phadej Jan 22, 2019
975dd6a
Use cryptohash-md5 (in tests)
phadej Jan 22, 2019
f289b64
Add more files to .gitignore
phadej Feb 22, 2019
76987d4
Better error message for "Query resulted in a command response"
linearray Feb 22, 2019
80a8698
Merge pull request #4 from phadej/no-th
phadej Feb 24, 2019
6e30ae7
Escape double '??' to a literal '?'
Vlix Mar 13, 2018
f03cd61
Merge pull request #8 from phadej/double-question-mark
phadej Feb 25, 2019
11c856c
Merge pull request #7 from linearray/master
phadej Feb 25, 2019
ebfc58b
Prepare for 0.6.1
phadej Mar 3, 2019
9c412c9
Merge pull request #10 from phadej/prepare-0.6.1
phadej Mar 3, 2019
e45ac60
Regenerate .travis.yml
phadej Mar 12, 2019
e832a2f
Merge pull request #11 from phadej/update-travis-2019-03
phadej Mar 13, 2019
d849b83
Regenerate .travis.yml
phadej Mar 22, 2019
0618511
Merge pull request #12 from phadej/haskell-ci-test
phadej Mar 27, 2019
3158633
Use MonadFail
phadej Apr 26, 2019
685ba2b
Merge pull request #14 from phadej/monad-fail
phadej Apr 26, 2019
7935496
Seems that inspection tests pass on GHC-8.8.1
phadej Apr 26, 2019
2bd1c05
Merge pull request #15 from phadej/ghc-8.8-inlines
phadej Apr 26, 2019
9f7af02
fix UPDATE example in executeMany comment
chris-martin Jun 21, 2019
f2d0a2f
Merge pull request #18 from chris-martin/patch-1
phadej Jun 21, 2019
183e126
Allow semigroups-0.19
phadej Jun 25, 2019
d0fcf28
Merge pull request #19 from phadej/semigroups-0.19
phadej Jun 25, 2019
ae72d0a
document `tableColumn` behavior on non-table columns
bergey Jul 2, 2019
4515c9d
Merge pull request #20 from bergey/docs
phadej Jul 2, 2019
1bca77b
Allow ghc-8.8 boot libs
phadej Sep 10, 2019
15761d1
Merge pull request #29 from phadej/ghc-8.8
phadej Sep 11, 2019
5e05f32
Updates 2019-09-19
phadej Sep 19, 2019
46b19b3
Merge pull request #31 from phadej/updates-2019-09-19
phadej Sep 20, 2019
25b5a7a
Fix spurious aborts when retrying transactions
3noch Oct 11, 2019
920ff81
Only catch SqlError in retryLoop
3noch Oct 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .ghci

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ dist/
.cabal-sandbox/
.stack-work/
cabal.sandbox.config
/dist-newstyle
/dist-newstyle
.ghc.environment.*
cabal.project.local
dump-core
217 changes: 154 additions & 63 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,164 @@
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
# This Travis job script has been generated by a script via
#
# haskell-ci '--config' 'cabal.haskell-ci' '--output' '.travis.yml' 'postgresql-simple.cabal'
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.5.20190916
#
language: c
sudo: false

dist: xenial
git:
# whether to recursively clone submodules
submodules: false
branches:
only:
- master
services:
- postgresql
addons:
postgresql: "10"
cache:
directories:
- $HOME/.cabsnap
- $HOME/.cabal/packages

- $HOME/.cabal/store
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar

- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
- rm -rfv $CABALHOME/packages/head.hackage
matrix:
include:
- env: CABALVER=1.18 GHCVER=7.8.4
compiler: ": #GHC 7.8.4"
addons: { apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}, postgresql: "9.3"}
- env: CABALVER=1.22 GHCVER=7.10.2
compiler: ": #GHC 7.10.2"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}, postgresql: "9.3"}
- env: CABALVER=1.24 GHCVER=8.0.1
compiler: ": #GHC 8.0.1"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}, postgresql: "9.3"}

- compiler: ghc-8.8.1
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
- compiler: ghc-8.6.5
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
- compiler: ghc-8.4.4
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
- compiler: ghc-8.2.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
- compiler: ghc-8.0.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
- compiler: ghc-7.10.3
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-3.0"]}}
- compiler: ghc-7.8.4
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-3.0"]}}
- compiler: ghc-7.6.3
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.6.3","cabal-install-3.0"]}}
before_install:
- unset CC
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
- createdb `whoami` || true

- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- WITHCOMPILER="-w $HC"
- HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
- HCPKG="$HC-pkg"
- unset CC
- CABAL=/opt/ghc/bin/cabal
- CABALHOME=$HOME/.cabal
- export PATH="$CABALHOME/bin:$PATH"
- TOP=$(pwd)
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
- echo $HCNUMVER
- CABAL="$CABAL -vnormal+nowrap+markoutput"
- set -o pipefail
- |
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
echo 'BEGIN { state = "output"; }' >> .colorful.awk
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
echo ' if (state == "cabal") {' >> .colorful.awk
echo ' print blue($0)' >> .colorful.awk
echo ' } else {' >> .colorful.awk
echo ' print $0' >> .colorful.awk
echo ' }' >> .colorful.awk
echo '}' >> .colorful.awk
- cat .colorful.awk
- |
color_cabal_output () {
awk -f $TOP/.colorful.awk
}
- echo text | color_cabal_output
install:
- cabal --version
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
then
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
fi
- travis_retry cabal update -v
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
- cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt

# check whether current requested install-plan matches cached package-db snapshot
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
then
echo "cabal build-cache HIT";
rm -rfv .ghc;
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
else
echo "cabal build-cache MISS";
rm -rf $HOME/.cabsnap;
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
cabal install --only-dependencies --enable-tests --enable-benchmarks;
fi

# snapshot package-db on cache miss
- if [ ! -d $HOME/.cabsnap ];
then
echo "snapshotting package-db to build-cache";
mkdir $HOME/.cabsnap;
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
fi

# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
- ${CABAL} --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- TEST=--enable-tests
- BENCH=--enable-benchmarks
- HEADHACKAGE=false
- rm -f $CABALHOME/config
- |
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
echo "write-ghc-environment-files: always" >> $CABALHOME/config
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
echo "install-dirs user" >> $CABALHOME/config
echo " prefix: $CABALHOME" >> $CABALHOME/config
echo "repository hackage.haskell.org" >> $CABALHOME/config
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
- |
echo "program-default-options" >> $CABALHOME/config
echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
- cat $CABALHOME/config
- rm -fv cabal.project cabal.project.local cabal.project.freeze
- travis_retry ${CABAL} v2-update -v
# Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project
- |
echo "packages: ." >> cabal.project
- |
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(postgresql-simple)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- rm cabal.project.freeze
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
script:
- if [ -f configure.ac ]; then autoreconf -i; fi
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
- cabal build # this builds all libraries and executables (including tests/benchmarks)
- cabal test
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
- ${CABAL} v2-sdist all | color_cabal_output
# Unpacking...
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
- cd ${DISTDIR} || false
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
- PKGDIR_postgresql_simple="$(find . -maxdepth 1 -type d -regex '.*/postgresql-simple-[0-9.]*')"
# Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project
- |
echo "packages: ${PKGDIR_postgresql_simple}" >> cabal.project
- |
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(postgresql-simple)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
# Building...
# this builds all libraries and executables (without tests/benchmarks)
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
# Building with tests and benchmarks...
# build & run tests, build benchmarks
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
# Testing...
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
# cabal check...
- (cd ${PKGDIR_postgresql_simple} && ${CABAL} -vnormal check)
# haddock...
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
# Building without installed constraints for packages in global-db...
- rm -f cabal.project.local
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output

# REGENDATA ["--config","cabal.haskell-ci","--output",".travis.yml","postgresql-simple.cabal"]
# EOF
87 changes: 84 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,88 @@
### Unreleased
### Version 0.6.2 (2019-04-26)

* Added `ToField` instances for case-insensitive strict and lazy text.
* Define `MonadFail Ok`.

### Version 0.6.1 (2019-03-04)

* Escape double '??' to a literal '?
Thanks to Felix Paulusma for the implementation.
https://github.com/phadej/postgresql-simple/pull/5

* Mention GHC Generics support in the documentation.
Thanks to Gabriel Gonzalez for the implementation.
https://github.com/phadej/postgresql-simple/pull/6

* Better error message for "Query resulted in a command response
Thanks to Max Amanshauser for the implementation.
https://github.com/phadej/postgresql-simple/pull/7

* fromJSONField: Include JSONPath on JSON parse errors
Thanks to Simon Hengel for the implementation.
https://github.com/phadej/postgresql-simple/pull/2

* No TH in implementation
https://github.com/phadej/postgresql-simple/pull/4

### Version 0.6 (2018-10-16)

* *Breaking change*: Use `Only` package's `Only` for a common 1-tuple.

Consider a downstream library depending already both on
`Only` and `postgresql-simple` package. This library my define
a `MyClass` with instances for `Only.Only` and `PostgreSQL.Only`.
As now these types are the same, a library would break.
Therefore I consider "merging" types a breaking change.

There are two ways for adopting this change in that scenario:

- Either CPP-guard `PostgreSQL.Only` instance with

```haskell
#if !MIN_VERSION_postgresql_simple(0,6,0)
instance MyClass (PostgreSQL.Only a) where ...
#endif
```

- or simply remove it and add `postgresql-simple >=0.6` lower bound,
making sure that there's only single `Only`.

* Add `ToField` instances for case-insensitive strict and lazy text.
Thanks to Max Tagher for the implementation.
https://github.com/lpsmith/postgresql-simple/pull/232

* Add support to CockroachDB.
Thanks to Georte Steel.
https://github.com/lpsmith/postgresql-simple/pull/245

* Add Generic ConnectInfo instance
Thanks to Dmitry Dzhus.
https://github.com/lpsmith/postgresql-simple/pull/235

* Add `fromFieldRange :: Typeable a => FieldParser a -> FieldParser (PGRange a)`
https://github.com/lpsmith/postgresql-simple/pull/221

* Add `fromFieldJSONByteString :: FieldParser ByteString`
https://github.com/lpsmith/postgresql-simple/pull/222/files

* Fix off-by-one error in year builder.
Thanks to Nathan Ferris Hunter.
https://github.com/lpsmith/postgresql-simple/pull/230

* Extend ToRow and FromRow to tuples of size 18
Thanks to Bardur Arantsson.
https://github.com/lpsmith/postgresql-simple/pull/229

* Add `Vector` and `Vector.Unboxed` `query` variants.
These are more memory efficient
(especially, if you anyway will convert to some vector)
https://github.com/phadej/1

* Documentation improvements
https://github.com/lpsmith/postgresql-simple/pull/227
https://github.com/lpsmith/postgresql-simple/pull/236

### Version 0.5.4.0 (2018-05-23)
* Support GHC-8.4 (Semigroup/Monoid)

### Version 0.5.3.0 (2017-05-15)
* Refactored some rudimentary cursor handling code out of the
Expand Down Expand Up @@ -260,7 +341,7 @@
* De-emphasized connect and ConnectInfo in favor of connectPostgreSQL.

### Version 0.4.2.2 (2014-05-15)
* Fixed compatibility with scientific-0.3.*, thanks to Adam Bergmark
* Fixed compatibility with scientific-0.3.\*, thanks to Adam Bergmark

* Improved documentation of the FromField module, as well as the fold,
foldWithOptions, executeMany, and returning operators.
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Patches welcome!

- If you are only going to bump bounds:
- If it's really **only bounds**, please simply open an issue (so you'll have a URL to refer to). I have a semi-automated process to make revisions, pull requests only disturb it.
- If patch includes **source code change** (i.e. I'll need to make a release), and it's a patch to support **newer base/GHC version**:
- Amend `tested-with` to include that GHC
- Regenerate `.travis.yml` with `haskell-ci regenerate` (get the latest from [GitHub haskell-ci/haskell-ci](https://github.com/haskell-ci/haskell-ci))

- Don't edit `CHANGELOG.md`, rather include a copyable entry in your pull request description. I often process pull requests in bulk, and everyone editing the `CHANGELOG.md` causes unnecessary conflicts.

- I use [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell) to format imports. I encourage you to use it too, when contributing.
- General code style is 4 spaces, just look around how it looks, it's not so strict.
Loading