Skip to content

Using Close protocol message instead of DEALLOCATE to help prepared statements in PgBouncer #589

@JelteF

Description

@JelteF

PgBouncer does currently not parse queries at all, only protocol messages. But psycopg closes its statements using DEALOCATE sql call:

self._maint_commands.append(b"DEALLOCATE " + name)

What do you think of about, instead of sending DEALLOCATE text query here, to instead send a Close protocol message? Because that would make it work automatically with the work-in-progress PgBouncer prepared statements patch: pgbouncer/pgbouncer#845

P.S. The DEALLOCATE ALL usage is similarly problematic, but maybe PgBouncer can make an exception for supporting that since it would be extremely easy to parse. And also it should not be necessary to use as I explained a few minutes ago on the PG mailing list thread that triggered this DEALLOCATE ALL usage (according to git blame): https://www.postgresql.org/message-id/flat/CAGECzQSUPTjfb7BYLg5c22tN4SSuLTRv9-6TpuZTpJ0q8hqp2w%40mail.gmail.com#b9b91ddf3d37160a3e8771e69b27f0ac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions