Skip to content

Commit b659f0f

Browse files
authored
Update plugins doc to the last version (#53)
1 parent 8a150f4 commit b659f0f

2 files changed

Lines changed: 24 additions & 11 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# ide
2+
.vscode
3+
14
# python
25
venv
36
site

docs/features/plugins/index.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ Inside your project's `Cargo.toml`, add the following settings and dependencies:
2929

3030
```toml
3131
[lib]
32-
crate-type = ["rlib", "cdylib"]
32+
crate-type = ["cdylib"]
3333

3434
[dependencies]
35-
pgdog-plugin = "0.1.6"
35+
pgdog-plugin = "0.2.0" # make sure to use the version compatible with your PgDog version
3636
```
3737

3838
This turns the crate into a shared library, exposing its functions using the C ABI, which PgDog will call at runtime.
@@ -60,7 +60,7 @@ macros::plugin!();
6060
This ensures the following requirements are followed:
6161

6262
1. The plugin is compiled with the same version of the Rust compiler as PgDog itself
63-
2. It is using the same version of `pg_query`
63+
2. It is using the same version of `pgdog-plugin`
6464

6565
See [Safety](#safety) section for more info.
6666

@@ -107,6 +107,18 @@ The [`Context`](https://docsrs.pgdog.dev/pgdog_plugin/context/struct.Context.htm
107107
- The Abstract Syntax Tree (AST) of the statement, parsed by `pg_query`
108108
- Parameter values, if the statement is prepared
109109

110+
##### `pg_query` types
111+
112+
For getting the AST types from `pg_query`, use the one of the following imports from the `pgdog_plugin` crates:
113+
114+
```rust
115+
// Manually use the exported primitives.
116+
use pgdog_plugin::pg_query;
117+
118+
// Automatically import them.
119+
use pgdog_plugin::prelude::*;
120+
```
121+
110122

111123
#### Outputs
112124

@@ -182,17 +194,15 @@ Whatever Rust compiler version is used to build PgDog itself needs to be used to
182194
PgDog provides the compiler version used to build it at startup:
183195

184196
```
185-
INFO: 🐕 PgDog vd4e9bc6 (rustc 1.89.0 (29483883e 2025-08-04))
197+
INFO pgdog: 🐕 PgDog v0.1.29 [main@ff3fe3e, pgdog-plugin 0.2.0, rustc 1.93.0 (254b59607 2026-01-19)]
186198
```
187199

188-
#### `pg_query` version
200+
#### `pgdog-plugin` compatibility
189201

190-
Since we're passing the AST itself down to the plugins, we need to make sure that the versions of the `pg_query` library used by PgDog and the plugin are the same. This is done automatically if you're using the primitives exported by the `pgdog-plugin` crate:
202+
To ensure your plugin works correctly with PgDog, the `pgdog-plugin` version used to build the plugin must be the same as the version used by PgDog. This compatibility is checked at startup, and incompatible plugins will not be loaded.
191203

192-
```rust
193-
// Manually use the exported primitives.
194-
use pgdog_plugin::pg_query;
204+
You can verify the `pgdog-plugin` version of your plugin by checking the PgDog startup logs:
195205

196-
// Automatically import them.
197-
use pgdog_plugin::prelude::*;
206+
```
207+
INFO pgdog: 🐕 PgDog v0.1.29 [main@ff3fe3e, pgdog-plugin 0.2.0, rustc 1.93.0 (254b59607 2026-01-19)]
198208
```

0 commit comments

Comments
 (0)