Skip to content

Do not invoke sync command while preparing unnamed prepared statement#759

Closed
mkabilov wants to merge 3 commits intolib:masterfrom
mkabilov:master
Closed

Do not invoke sync command while preparing unnamed prepared statement#759
mkabilov wants to merge 3 commits intolib:masterfrom
mkabilov:master

Conversation

@mkabilov
Copy link

@mkabilov mkabilov commented Jun 11, 2018

Current implementation of the execution of the queries with arguments (i.e. non-simpleQueries) implicitly creates unnamed prepared statement followed by execute command; both done in the separate transactions (by invoking Sync after prepare).

This might be an issue if one uses a connection pooler in a transaction pool mode like pgbouncer or odyssey

Fixes #889

@mescam
Copy link

mescam commented Jun 15, 2020

Hi,

is there any particular reason why this patch was not merged? We are experiencing issues described in #889 and after applying this patch it looks like the errors are gone. We are still investigating if this breaks anything else, but would be nice to hear from the maintainers.

@cobolbaby

This comment was marked as spam.

exfly added a commit to exfly/pq that referenced this pull request Jun 13, 2025
exfly added a commit to exfly/pq that referenced this pull request Jun 13, 2025
exfly added a commit to exfly/pq that referenced this pull request Jun 13, 2025
arp242 pushed a commit to exfly/pq that referenced this pull request Dec 31, 2025
@arp242 arp242 added bug needs-test Needs a test before it can be merged labels Jan 1, 2026
@arp242
Copy link
Collaborator

arp242 commented Jan 24, 2026

How can this be tested? I added pgbouncer to the CI a few weeks ago, and all tests seem to work? I added pool_mode=transaction (locally), and this seems to work as well?

@arp242 arp242 added the needs-feedback Requires feedback to be actionable label Jan 24, 2026
@mkabilov
Copy link
Author

mkabilov commented Feb 4, 2026

I think at this point someone had already fixed the issue with connection poolers.

and in case it is not fixed, here is the workaround: use "binary_parameters=yes" as stated here: #889 (comment) or use https://github.com/jackc/pgx

@mkabilov mkabilov closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug needs-feedback Requires feedback to be actionable needs-test Needs a test before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unnamed prepared statement does not exist ERROR on production/staging servers

4 participants