Developer documentation with dependancies, build instructions, how to build a Docker image, update the documentation and run unit tests.
- PostgreSQL and PostgreSQL development packages must be installed (pg_config
and server headers). For Red Hat and Ubuntu, the package names are usually
postgresql-devorpostgresql-devel - LibXML2 development packages must be installed, usually
libxml2-devorlibxml2-devel - CUnit packages must be installed
- [Optional]
laz-perflibrary may be installed for LAZ compression support (built from source)
After generating the configure script with autogen.sh, you can use
./configure --help to get a complete listing of configuration options.
$ ./autogen.sh
$ ./configure
$ make
$ sudo make installNote
You can use --with-pgconfig on the ./configure command line if
you have multiple PostgreSQL installations on your system and want to target a
specific one. For example:
$ ./configure --with-pgconfig=/usr/lib/postgresql/12/bin/pg_configNote
If qsort_r is not available on your system, then you can use the embedded
implementation instead thanks to the next directive:
$ ./configure CFLAGS="-DNESTED_QSORT=1"Unit tests
$ make checkRegressions tests
pgPointcloud includes SQL tests to run against an existing installation. To run the SQL tests:
$ sudo make install
$ PGUSER=a_user PGPASSWORD=a_password PGHOST=localhost make installcheckThis command will create a database named contrib_regression and will execute
the SQL scripts located in pgsql/sql in this database.
If you are writing your own loading system and want to write into Pointcloud types, create well-known binary inputs, in uncompressed format. If your schema indicates that your patch storage is compressed, Pointcloud will automatically compress your patch before storing it, so you can create patches in uncompressed WKB without worrying about the nuances of particular internal compression schemes.
The only issues to watch when creating WKB patches are: ensuring the data you write is sized according to the schema (use the specified dimension type); ensuring that the endianness of the data matches the declared endianness of the patch.
Sphinx is used to build the documentation. For that, you have to install the next Python packages:
sphinxsphinx_rtd_theme
Then:
$ cd doc && make htmlThe HTML documentation is available in doc/build/html.
Note
The documentation can be generated in another format like pdf, epub, ...
You can use make to get a list of all available formats.
A Dockerfile is provided in the docker directory and based on the
official PostgreSQL docker image available DockerHub. The image generated
is based on PostgreSQL 14, PostGIS 3 and the laz-perf support is activated.
$ docker build --rm -t pgpointcloud docker/pgPointcloud tests are run with Github Actions on several Ubuntu versions and with various PostgreSQL/PostGIS releases:
| w/o PostGIS | PostGIS 3.3 | |
| PostgreSQL 13 | ||
| PostgreSQL 14 | ||
| PostgreSQL 15 | ||
| PostgreSQL 16 | ||
| PostgreSQL 17 |
Steps for releasing a new version of Pointcloud:
- Add a new section to the
NEWSfile, listing all the changes associated with the new release. - Change the version number in the
README,Version.configandpgsql/expected/pointcloud.outfiles. - Update the value of
UPGRADABLEinpgsql/Makefile.inandpgsql_postgis/Makefile. This variable defines the versions from which a database can be upgraded to the new Pointcloud version. - Create a PR with these changes.
- When the PR is merged create a tag for the new release and push it to GitHub:
$ git tag -a vx.y.z -m 'version x.y.z'
$ git push origin vx.y.zFor checking the memory management of pgPointcloud extension, Valgrind can
be used with PostgreSQL in single-user mode.
But first, it's necessary to compile the extension with debug symbols and without compiler optimizations:
$ ./configure CFLAGS="-O0 -g"
$ make
$ sudo make installDebug symbols may also be installed for PostgreSQL and PostGIS. For example for Debian based distributions with PostgreSQL 13 and PostGIS 3:
$ sudo apt-get install postgresql-13-dbgsym postgresql-13-postgis-3-dbgsymAnd finally:
$ echo "select pc_transform(patch, 1) from patchs limit 1" | \
valgrind -s --track-origins=yes --leak-check=yes \
--show-leak-kinds=all --read-var-info=yes --log-file=/tmp/valgrind.log \
/usr/lib/postgresql/13/bin/postgres --single -D /var/lib/postgresql/13/main \
-c config_file=/etc/postgresql/13/main/postgresql.conf \
mydatabaseThen Valgrind's report is available in /tmp/valgrind.log.
GDB may be attached to a running session for debugging purpose:
$ psql mydatabase
psql (14.5)
Type "help" for help.
mydatabase=# select pid from pg_stat_activity where usename = 'pblottiere' and state = 'active';
pid
-------
34699
(1 row)$ sudo gdb -p 34699
GNU gdb (GDB) 12.1
(gdb)Then you can execute a SQL request in the corresponding session and use GDB as usual (step by step, backtrace, ...).