Re: psql: Add command to use extended query protocol

From: Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: psql: Add command to use extended query protocol
Date: 2023-09-14 20:26:55
Message-ID: 53A726DF-E045-458A-9A59-C0B2F8835DD2@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In one of my environments, this feature didn't work as expected. Digging into it, I found that it is incompatible with FETCH_COUNT being set. Sorry for not recognising this during the betas.

Attached a simple patch with tests running the cursor declaration through PQexecParams instead of PGexec.

Alternatively, we could avoid going to ExecQueryUsingCursor and force execution via ExecQueryAndProcessResults in SendQuery (around line 1134 in src/bin/psql/common.c) when \bind is used:

else if (pset.fetch_count <= 0 || pset.gexec_flag ||
- pset.crosstab_flag || !is_select_command(query))
+ pset.crosstab_flag || !is_select_command(query) ||
+ pset.bind_flag)

best regards
Tobias

Attachment Content-Type Size
psql-bind-fetch_count.patch application/octet-stream 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-09-14 21:43:51 Re: [PATCH] Add CANONICAL option to xmlserialize
Previous Message stepan rutz 2023-09-14 19:27:18 Re: Detoasting optionally to make Explain-Analyze less misleading