Is there a relationship between Hyperdrive cache settings and the use of prepared statements? I am

Is there a relationship between Hyperdrive cache settings and the use of prepared statements?

I am exploring Postgres through Rust (using the
tokio-postgres
crate) using the
query
method. This uses the extended query protocol. I am observing the following behavior. When the Hyperdrive cache is:

  • Disabled: All (or most) queries fail (the driver reports an
    UnexpectedMessage
    error). I suspect disabled caching makes Hyperdrive use one connection for preparation and another execution on another. Occasionally, it might use the same connection, leading to a successful query.
  • Enabled: All queries succeed. I suspect caching makes Hyperdrive choose the same connection it used to prepare the statement.
Am I interpreting this correctly? Is this the expected behavior?

p.s. This seems to have changed recently. Earlier,
query
would always fail regardless of the cache setting. So, I started working on a PR for the Postgres driver to make it work with Hyperdrive. But today, during testing that PR, I saw this behavior, thus this question.
An asynchronous PostgreSQL client.
Was this page helpful?