
#-----------------------------------------------------------------------------------------------------------------------
# build 13
#-----------------------------------------------------------------------------------------------------------------------
mkdir -p ~/src

cd ~/src
wget https://ftp.postgresql.org/pub/source/v13.3/postgresql-13.3.tar.bz2
tar -xjf postgresql-13.3.tar.bz2 -C ~/src/
cd ~/src/postgresql-13.*/

# /usr/lib/postgresql/13/bin/pg_config
# --with-icu --with-gssapi --with-extra-version='(Ubuntu 13.2.test)'

./configure --prefix=/usr/local/pgsql/13 \
  --enable-debug --enable-cassert --enable-dtrace --disable-rpath --enable-thread-safety \
  --enable-tap-tests --enable-nls \
  --with-llvm LLVM_CONFIG='/usr/bin/llvm-config-9' CLANG='/usr/bin/clang-9' \
  --with-system-tzdata='/usr/share/zoneinfo' \
  --with-python --with-tcl --with-perl --with-uuid=e2fs --with-libxml --with-libxslt \
  --with-pam --with-openssl --with-systemd --with-selinux --with-ldap

make --jobs=6
make test
sudo rm -rf /usr/local/pgsql/13
sudo make install
sudo /sbin/ldconfig /usr/local/pgsql/13/lib

cd ~/src/postgresql-13.*/contrib/
make --jobs=6
sudo make install

make clean
cd ..
make clean

#-----------------------------------------------------------------------------------------------------------------------
# start
#-----------------------------------------------------------------------------------------------------------------------
/usr/local/pgsql/13/bin/pg_ctl start -W -c -D ~/13/dbg-test -l ~/log/postgresql-13-dbg-test.log
# /usr/local/pgsql/13/bin/pg_ctl start -c -D ~/13/dbg-test -l ~/log/postgresql-13-dbg-test.log
tail -f ~/log/postgresql-13-dbg-test.log

psql -h postgres.vmware -p 5433 test
SET max_parallel_workers_per_gather TO 4;
SELECT sum(sign*Betrag) FROM kpos_test, setof_kpos(kpos);
\q


rm -rf ~/crash/test
apport-unpack /var/crash/_usr_local_pgsql_13_bin_postgres.112.crash ~/crash/test
rm -f /var/crash/_usr_local_pgsql_13_bin_postgres.112.crash
gdb /usr/local/pgsql/13/bin/postgres ~/crash/test/CoreDump

