Project

General

Profile

1
#!/bin/sh
2
# Translates a PostgreSQL DB dump for the local server's version
3
# Usage: self {input...|<input} >translated
4

    
5
selfDir="$(dirname -- "$0")"
6

    
7
# PostgreSQL 9.x started putting plpgsql into template0, screwing everything up.
8
# We solve this by putting plpgsql in the dump so that versions before 9.x get
9
# it, and removing it when restoring to a 9.x server.
10
if test "$("$selfDir/pg_version")" -ge 9; then
11
    grep -v -F 'CREATE PROCEDURAL LANGUAGE plpgsql;' "$@"
12
else cat "$@" # pass through
13
fi
(11-11/68)