How to install/configure/backups Postgresql on debian

NOTE: This page is intented to be used to develop features to postgresql. Do not use this for production!

some tools to get install before

$ apt-get install zsh tree git curl wget emacs libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-dev build-essential llvm-3.9 llvm-3.9-dev clang-3.9 clang-3.9-dev bison flex libreadline-dev libreadline

to enable TAP tests:

$ perl -MCPAN -e shell
install CPAN
reload CPAN
install TAP::Parser::SourceHandler::pgTAP
install IPC::Run


$ cd postgresql
$ mkdir builds && cd $_
../configure --enable-debug --enable-depend --enable-tap-tests --enable-cassert CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer"
$ make
$ make check
# needs root access below (go to the postgresql directory)
$ su -
$ make install
$ /sbin/ldconfig /usr/local/pgsql/lib
$ adduser --system --home /usr/local/pgsql/data --shell /bin/bash --group postgres
$ passwd postgres
# logout from root access
$ su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data --pwprompt
$ echo 'PATH=/usr/local/pgsql/bin:$PATH' >> ~/.zshrc
$ echo 'export PGDATA=/usr/local/pgsql/data' >> ~/.zshrc