A long time ago I blogged on how you can use the PostgreSQL development snapshots to test new PostgreSQL features before alpha/beta/rc releases are officially released. Another way to do this is to use git to get the latest sources and build PostgreSQL from there. Everything which was committed will be available to test. Btw: A great way to stay up to date is to subscribe to the mailing list just referenced. You’ll get a mail for each commit that happened, maybe one of those is getting your attention?
To start you’ll obviously need git. For distributions using yum this is just a matter of:
postgres@pgbox:/home/postgres/ [pg960final] sudo yum install git
For systems using apt use:
postgres@pgbox:/home/postgres/ [pg960final] sudo apt-get install git
Depending on how you want to configure PostgreSQL you’ll need some development packages as well. For yum based systems this is a good starting point:
postgres@pgbox:/home/postgres/ [pg960final] sudo yum install -y gcc openldap-devel python-devel readline-devel redhat-lsb bison flex perl-ExtUtils-Embed zlib-devel crypto-utils openssl-devel pam-devel libxml2-devel libxslt-devel tcl tcl-devel openssh-clients bzip2 net-tools wget screen ksh unzip
For apt based systems you might want to start with this:
postgres@pgbox:/home/postgres/ [pg960final] sudo apt-get install libldap2-dev libpython-dev libreadline-dev libssl-dev bison flex libghc-zlib-dev libcrypto++-dev libxml2-dev libxslt1-dev tcl tclcl-dev bzip2 wget screen ksh libpam0g-dev libperl-dev make unzip libpam0g-dev tcl-dev python
Not all of those packages are required, they just reflect what we usually install before building PostgreSQL from source. Of course you should adjust this and remove packages that are not required for what you plan to do.
How do you then get the latest PostgreSQL sources? Quite easy, it is documented in the PostgreSQL wiki:
postgres@pgbox:/home/postgres/ [pg960final] mkdir IwantToTest postgres@pgbox:/home/postgres/ [pg960final] cd IwantToTest/ postgres@pgbox:/home/postgres/IwantToTest/ [pg960final] git clone git://git.postgresql.org/git/postgresql.git
The result should look similar to this:
Cloning into 'postgresql'... remote: Counting objects: 629074, done. remote: Compressing objects: 100% (95148/95148), done. remote: Total 629074 (delta 534080), reused 626282 (delta 531478) Receiving objects: 100% (629074/629074), 184.31 MiB | 26.40 MiB/s, done. Resolving deltas: 100% (534080/534080), done.
From now on you have the complete PostgreSQL sources locally available.
postgres@pgbox:/home/postgres/IwantToTest/ [pg960final] cd postgresql/; ls aclocal.m4 config configure configure.in contrib COPYRIGHT doc GNUmakefile.in HISTORY Makefile README README.git src
Ready to test? Yes, but what? One possible way to start is asking git for what was committed recently:
postgres@pgbox:/home/postgres/IwantToTest/postgresql/ [pg960final] git log commit 0de791ed760614991e7cb8a78fddd6874ea6919d Author: Peter Eisentraut [email protected] Date: Wed May 3 21:25:01 2017 -0400 Fix cursor_to_xml in tableforest false mode It only produced elements but no wrapping table element. By contrast, cursor_to_xmlschema produced a schema that is now correct but did not previously match the XML data produced by cursor_to_xml. In passing, also fix a minor misunderstanding about moving cursors in the tests related to this. Reported-by: [email protected] Based-on-patch-by: Thomas Munro [email protected] ...
Usually you can find a link to the discussion in the commit message so can you read through the history of a specific commit. Another way is to read the development documentation or the upcoming release notes once available.
All you need to do then is to build PostgreSQL:
postgres@pgbox:/home/postgres/IwantToTest/postgresql/ [pg960final] ./configure postgres@pgbox:/home/postgres/IwantToTest/postgresql/ [pg960final] make all postgres@pgbox:/home/postgres/IwantToTest/postgresql/ [pg960final] sudo make install postgres@pgbox:/home/postgres/IwantToTest/postgresql/ [pg960final] cd contrib postgres@pgbox:/home/postgres/IwantToTest/postgresql/contrib/ [pg960final] make all postgres@pgbox:/home/postgres/IwantToTest/postgresql/contrib/ [pg960final] sudo make install postgres@pgbox:/home/postgres/IwantToTest/postgresql/contrib/ [pg960final] /usr/local/pgsql/bin/initdb -D /var/tmp/test postgres@pgbox:/home/postgres/IwantToTest/postgresql/contrib/ [pg960final] /usr/local/pgsql/bin/pg_ctl -D /var/tmp/test start postgres@pgbox:/home/postgres/IwantToTest/postgresql/contrib/ [pg960final] /usr/local/pgsql/bin/psql postgres psql (10devel) Type "help" for help. pgbox/postgres MASTER (postgres@5432) #
Happy testing …