Skip to content

Commit 251f30b

Browse files
authored
Update PgBouncer docs around prepared statements (#751)
1 parent b419aff commit 251f30b

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,14 @@ query("select nextval($1)", [sequence_oid])
133133

134134
## PgBouncer
135135

136-
When using PgBouncer with transaction or statement pooling named prepared
137-
queries can not be used because the bouncer may route requests from the same
138-
postgrex connection to different PostgreSQL backend processes and discards named
139-
queries after the transactions closes. To force unnamed prepared queries:
136+
PgBouncer versions 1.21.0 and later support named prepared statements. If you are using an older version of PgBouncer with transaction or statement pooling, named prepared queries cannot be used because the bouncer may route requests from the same Postgrex connection to different PostgreSQL backend processes and discards named queries after the transaction closes. To force unnamed prepared queries in such older versions:
140137

141138
```elixir
142139
Postgrex.start_link(prepare: :unnamed)
143140
```
144141

142+
[PgBouncer 1.21.0 release notes](https://www.pgbouncer.org/changelog.html#pgbouncer-121x)
143+
145144
## Contributing
146145

147146
To contribute you need to compile Postgrex from source and test it:

lib/postgrex.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ defmodule Postgrex do
200200
201201
## PgBouncer
202202
203-
When using PgBouncer with transaction or statement pooling named prepared
204-
queries can not be used because the bouncer may route requests from
205-
the same postgrex connection to different PostgreSQL backend processes
206-
and discards named queries after the transactions closes.
207-
To force unnamed prepared queries set the `:prepare` option to `:unnamed`.
203+
PgBouncer versions 1.21.0 and later support named prepared statements. If you are using an
204+
older version of PgBouncer with transaction or statement pooling, named prepared queries
205+
cannot be used because the bouncer may route requests from the same Postgrex connection
206+
to different PostgreSQL backend processes and discards named queries after the transaction closes.
207+
To force unnamed prepared queries in such older versions, set the `:prepare` option to `:unnamed`.
208208
209209
## Handling failover
210210

0 commit comments

Comments
 (0)