It seems that PostgreSQL transactional pool mode is not supported yet.
- Dominant language
- Go
- Stars
- 15.7k
- Forks
- 1.4k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 7
Description
## Describe the bug
Problem:
Using pgbouncer's transaction mode (port 6543) instead of session mode causes critical issues:
Parameter Binding Error
Error message "bind message supplies 4 parameters, but prepared statement requires 1" typically occurs when pgbouncer creates new connections for each query.
This breaks XORM's parameter binding mechanism, causing a mismatch in the number of parameters expected by the query statement. (It seems session states are being used and lost.)
Example error:
> bind message supplies 4 parameters, but prepared statement requires 1
For the Query: "SELECT \"id\", \"created_at\", \"updated_at\", \"user_id\", \"invite_user_id\", \"last_edit_user_id\", \"title\", \"original_text\", \"parsed_text\", \"pin\", \"show\", \"status\", \"view_count\", \"unique_view_count\", \"vote_count\", \"answer_count\", \"hot_score\", \"collection_count\", \"follow_count\", \"accepted_answer_id\", \"last_answer_id\", \"post_update_time\", \"revision_id\" FROM \"question\" WHERE \"question\".\"status\" IN ($1,$2) AND (question.show = $3) AND (question.created_at > $4) ORDER BY question.pin desc,question.hot_score DESC LIMIT 6"
### To Reproduce
Steps to reproduce the behavior:
1. With a brand new system being set up with an transaction mode postgresdb, you can get the error everytime.
### Expected behavior
5xx error report
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with PostgreSQL behind pgbouncer in transaction mode on port 6543, using the query and parameter-binding error from the report. Trace how the connection and prepared-statement state are handled; done means the query no longer fails with a parameter-count mismatch in transaction mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100