pgcat icon indicating copy to clipboard operation
pgcat copied to clipboard

Errors in some libraries when using PreparedStatements

Open civilizeddev opened this issue 11 months ago • 0 comments

I am using a PostgreSQL library called pg in Go.

I discovered a common error occurring in pgcat, similar to what happens with another DB pooler, PgBouncer.

pq: unnamed prepared statement does not exist

I don't know the details, but it seems that the following option needs to be included in the DSN string.

"binary_parameters=yes"

For example, like this:

"host=localhost port=5432 user=postgres password=xxx dbname=mydb sslmode=require binary_parameters=yes"

It might be helpful for users if this information is added to the README.

Do you have any other thoughts?

Reference

  • https://stackoverflow.com/questions/17614441/pq-driver-prepared-statement-does-not-exist/53225070#53225070
  • https://pkg.go.dev/github.com/lib/pq#hdr-Data_Types

civilizeddev avatar Mar 11 '24 09:03 civilizeddev