Skip to content

Commit

Permalink
enforce a minimum version of pg_dump
Browse files Browse the repository at this point in the history
We need pg_dump and pg_dumpall of version 8.4
  • Loading branch information
orgrim committed Nov 2, 2021
1 parent 2d082e9 commit d61b0b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ in the current directory:
docker run --rm -v "$PWD":/go/bin golang:1.16 go get github.com/orgrim/pg_back
```

## Minimum versions

The minimum version of `pg_dump` et `pg_dumpall` required to dump is 8.4. The
oldest tested server version of PostgreSQL is 8.2.

## Usage

Use the `--help` or `-?` to print the list of available options. To dump all
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ func main() {
binDir = opts.BinDirectory
}

// Ensure that pg_dump accepts the options we will give it
pgDumpVersion := pgToolVersion("pg_dump")
if pgDumpVersion < 80400 {
l.Fatalln("provided pg_dump is older than 8.4, unable use it.")
os.Exit(1)
}

// Parse the connection information
l.Verboseln("processing input connection parameters")
Expand Down

0 comments on commit d61b0b0

Please sign in to comment.