Skip to content

Commit 59aada0

Browse files
committed
Document unnamed prepared statements
1 parent 755c149 commit 59aada0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

docs/configuration/pgdog.toml/general.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,11 @@ Enables support for prepared statements. Available options are:
303303

304304
- `disabled`
305305
- `extended`
306+
- `extended_anonymous`
306307
- `full`
307308

308309
Full enables support for rewriting prepared statements sent over the simple protocol. Extended handles prepared statements sent normally
309-
using the extended protocol. `full` attempts to rewrite prepared statements sent using the simple protocol.
310+
using the extended protocol. `full` attempts to rewrite prepared statements sent using the simple protocol. `extended_anonymous` caches and rewrites unnamed prepared statements, which is useful for some legacy client drivers.
310311

311312
Default: **`extended`**
312313

docs/features/prepared-statements.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,14 @@ prepared_statements = "full"
8181

8282
Statements prepared using this method can be executed normally with `Bind` and `Execute` messages. Result data types can be inspected with `Describe`, just
8383
like a regular prepared statement.
84+
85+
## Unnamed statements
86+
87+
By default, unnamed (or anonymous) prepared statements are not cached and are sent to Postgres as-is. This works fine for most client drivers because they send the entire query in a single request. However, some drivers, like `go/pq` do not.
88+
89+
To make those drivers work, consider caching and rewriting unnamed prepared statements, like so:
90+
91+
```toml
92+
[general]
93+
prepared_statements = "extended_anonymous"
94+
```

0 commit comments

Comments
 (0)