Skip to content

Commit

Permalink
Merge pull request #180 from dentiny/hjiang/add-readme-on-query
Browse files Browse the repository at this point in the history
Add readme on query prefix
  • Loading branch information
Dtenwolde authored Dec 16, 2024
2 parents fb38a09 + bb823f8 commit 0e7eb79
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,37 @@ export VCPKG_TOOLCHAIN_PATH=`pwd`/vcpkg/scripts/buildsystems/vcpkg.cmake
Note: VCPKG is only required for extensions that want to rely on it for dependency management. If you want to develop an extension without dependencies, or want to do your own dependency management, just skip this step. Note that the example extension uses VCPKG to build with a dependency for instructive purposes, so when skipping this step the build may not work without removing the dependency.

### Build steps
Now to build the extension, run:
Checkout git submodules:
```sh
make
git submodule update --init --recursive
```
The main binaries that will be built are:
Now to build the extension, run:
```sh
./build/release/duckdb
./build/release/test/unittest
./build/release/extension/duckpgq/duckpgq.duckdb_extension
make <debug> GEN=ninja
```
The location of the binaries depends on the `BUILD_TYPE` flag (`release` or `debug`) specified during the build process. By default, the binaries are organized as follows:

### For a **release build** (`make release`):
- DuckDB binary: `./build/release/duckdb`
- Unit tests: `./build/release/test/unittest`
- DuckPGQ extension: `./build/release/extension/duckpgq/duckpgq.duckdb_extension`

### For a **debug build** (`make debug`):
- DuckDB binary: `./build/debug/duckdb`
- Unit tests: `./build/debug/test/unittest`
- DuckPGQ extension: `./build/debug/extension/duckpgq/duckpgq.duckdb_extension`

Ensure you specify the appropriate `BUILD_TYPE` flag when configuring the build to place binaries in the corresponding directory.
- `duckdb` is the binary for the duckdb shell with the extension code automatically loaded.
- `unittest` is the test runner of duckdb. Again, the extension is already linked into the binary.
- `duckpgq.duckdb_extension` is the loadable binary as it would be distributed.

## Running the extension
To run the extension code, simply start the shell with `./build/release/duckdb`.

> [!CAUTION]
> Any query containing SQL/PGQ syntax requires a `-` at the start of the query when building the extension from the source, otherwise, you will experience a segmentation fault. This is not the case when loading the extension from DuckDB.
## Running the tests
Different tests can be created for DuckDB extensions. The primary way of testing DuckDB extensions should be the SQL tests in `./test/sql`. These SQL tests can be run using:
```sh
Expand Down

0 comments on commit 0e7eb79

Please sign in to comment.