7

Recently in DigitalOcean has the opportunity to create Databases. This is something like a turnkey solution based on the usual Droplet with a bunch of additional database features.

One of these additional features — Connection Pools. As far as I understand this is a PgBouncer.

If I connect the database to the Rails 5.2 application in the usual way (directly), then everything is fine.

But if I use the connection through the "Connection Pools", I will get an error:

ActiveRecord::StatementInvalid: PG::DuplicatePstatement: ERROR: prepared statement "a1" already exists

This will occur when any data is received from the database.

Tell me, please, how to make it all work?

Colibri
  • 993
  • 11
  • 29

1 Answers1

17

Set prepared_statements and advisory_locks to false in the database configurations.

More info here.

Husam Bilal
  • 171
  • 2