4 ms·
This may sound naive, but implementing your own pooler is very easy e.g. in Go pgproto3 already does all packet-parsing for you. Transaction poolers are looking
by x4m 5y ago
This may sound naive, but implementing your own pooler is very easy e.g. in Go
pgproto3 already does all packet-parsing for you.
Transaction poolers are looking on ReadyForQuery packet and it's "in trnsaction" property like this [0]. All you need - is stick server connection on new ParameterStatus[1] packet for "SET search_path" instead of ReadyForQuery.
[0] https://github.com/pg-sharding/spqr/blob/358f816cd8a964a9c9e86456b1b73edff7c0af04/router/pkg/rrouter/relay.go#L258 https://github.com/pg-sharding/spqr/blob/358f816cd8a964a9c9e...
[1] https://www.postgresql.org/docs/10/protocol-flow.html#id-1.10.5.7.3 https://www.postgresql.org/docs/10/protocol-flow.html#id-1.1...
- CyberDem0n 5y agoIt's not enough to intercept `set search_path`, in fact any arbitrary function could change it, but Postgres doesn't report it back, unlike some other gucs.
- x4m 5y agoHmm, yes. ParameterStatus is not sent when search_path is changed. But I think it would be trivial to patch PostgreSQL to send it. I bet one even can push such patch through commitfest.