Directory postgresql/ contains PostgreSQL sources that were automatically patched to make all global variables to become thread-local ones. This makes it possible to use pg functions in multi-thread environment.
Also, there are some additional commits to postgresql/ (mostly backports from newer PostgreSQL versions or renames of PostgreSQL C functions when corresponding function is reimplemented outside of postgresql/ directory/)
Base version of PostgreSQL can be seen in copy_src.sh script (VERSION variable).
copy_src.sh script downloads, configures and builds static postgresql.a library from original PostgreSQL sources with minor patches (source.patch). After that, it finds all global r/w symbols by analyzing output of "objdump postgresql.a" command. Then it copies all necessary *.c and *.h files to postgresql/ directory, automatically changing all static variables to thread-local ones.
How to upgrade to newer PostgreSQL:
libicu-dev icu-devtools pkg-config liblz4-dev libreadline-dev libssl-dev libxml2-dev libossp-uuid-dev
./copy_src.sh && git diff -R postgresql > local_changes.patch
In file local_changes.patch you will get all changes applied to postgresql/ directory which are not part of automated patching by copy_src.sh
git checkout .
Bump PostgreSQL version in copy_src.sh (it is recommended not to do big jumps here)
Run ./copy_src.sh
Assuming compilation and automatic patching were successful, apply local changes collected on step 2:
patch -p6 < local_changes.patch
Resolve possible conflicts. Usually, conflicts arise due to some already backported changes
(cd ../../tools/pg_catalog_dump/ && yag make --build=relwithdebinfo && ./pg_catalog_dump > dump.json)
./generate_kernels.py
yag make --build=relwithdebinfo -tA -C ut -C test -C ../../sql/pg/ut
./verify.sh
Should output OK