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:
- With a brand new system being set up with an transaction mode postgresdb, you can get the error everytime.
Expected behavior
5xx error report