Re: [BUG] pg_stat_statements and extended query protocol

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>, "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, David Zhang <david(dot)zhang(at)highgo(dot)ca>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUG] pg_stat_statements and extended query protocol
Date: 2023-04-06 00:53:50
Message-ID: ZC4YHhwYhhu/A0Hv@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 05, 2023 at 05:39:35PM -0700, Andres Freund wrote:
> Seems like a complicated enough facility to benefit from a test or two? Peter
> Eisentraut added support for the extended query protocol to psql, so it
> shouldn't be too hard...

PQsendQueryGuts() does not split yet the bind/describe phase and the
execute phases, so we'd need a couple more libpq APIs to do that, with
more tracking of the state we're currently on when looping across
multiple execute fetches. My guess is that it is possible to follow a
model similar to JDBC here. I don't think that's necessarily
complicated, but it is not as straight-forward as it looks. \bind was
much more straight-forward than that, as it can feed on a single call
of PQsendQueryParams() after saving a set of parameters. An \exec
would not completely do that.

Attaching one of the scripts I've played with, in a very rusty java
with no classes or such, for future reference. Just update CLASSPATH
to point to a copy of the JDBC driver, run it with a java command, and
then look at rows, query in pg_stat_statements.
--
Michael

Attachment Content-Type Size
Test.java text/x-java 2.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-04-06 01:14:47 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode
Previous Message Melanie Plageman 2023-04-06 00:41:48 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode