https://github.com/cppgres/cppgres
Postgres extensions in C++
https://github.com/cppgres/cppgres
extensions postgres postgresql
Last synced: 9 months ago
JSON representation
Postgres extensions in C++
- Host: GitHub
- URL: https://github.com/cppgres/cppgres
- Owner: cppgres
- License: postgresql
- Created: 2025-02-24T04:24:06.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-09-12T13:30:53.000Z (9 months ago)
- Last Synced: 2025-09-12T15:58:45.172Z (9 months ago)
- Topics: extensions, postgres, postgresql
- Language: C++
- Homepage: https://cppgres.org/
- Size: 7.92 MB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cppgres: Postgres extensions in C++
Cppgres allows you to build Postgres extensions using C++: a high-performance, feature-rich
language already supported by the same compiler toolchains used to develop for Postgres,
like GCC and Clang.
## Features
* Header-only library
* Compile and runtime safety checks
* Automatic type mapping
* Ergonomic executor API
* Modern C++20 interface & implementation
* Direct integration with C
## Building
You don't really need to build this library as it is headers-only. You can,
however, use `cppgres` target from the included CMake file.
### Amalgamation
If copying the entire `src` directory is not convenient, it is quite easy to
get an amalgamated single-file header.
For example, using [cpp-amalgamate](https://github.com/Felerius/cpp-amalgamate):
```shell
cpp-amalgamate src/cppgres.hpp > cppgres.hpp
```
This file can be used just as before:
```c++
#include
```
## Running tests
```shell
# prepare
cmake -S . -B build
# run tests
CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target all test
```
If you want to run tests on a specific version (or major version) of Postgres, specify the `PGVER` variable:
```shell
cmake -S . -B build -DPGVER=16
```
By default, our build process will set up its own copy of Postgres. If you'd like to use your own build,
specify the `PG_CONFIG` variable:
```shell
cmake -S . -B build -DPG_CONFIG=/path/to/pg_config
```