Instant postgres
Sometimes I need a temporary postgres to try something out.
I keep this script around as instantpg.sh
:
#!/bin/bash
trap "rm -rf -- $PGDATA" EXIT
export PGDATA="$(mktemp -d)" PGPORT=1234
initdb
echo "Connect with: psql -p \"$PGPORT\" -h localhost -d postgres"
postgres -F -k ""