Re: [PATCH] Add additional extended protocol commands to psql: \parse and \bind

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add additional extended protocol commands to psql: \parse and \bind
Date: 2024-09-19 08:53:07
Message-ID: CAGECzQSTE7CoM=Gst56Xj8pOvjaPr09+7jjtWqTC40pGETyAuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 19 Sept 2024 at 09:30, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> Issuing an error if there is a state does not sound like a good idea
> at this stage because it would suddenly break scripts that expect
> multiple commands of \bind to prioritize the last one.

Seems like a good idea to add a simple test for that behaviour then.
See attached.

On Thu, 19 Sept 2024 at 09:30, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Wed, Sep 18, 2024 at 06:08:54PM +0900, Michael Paquier wrote:
> > On Wed, Sep 18, 2024 at 09:42:43AM +0200, Anthonin Bonnefoy wrote:
> >> I've joined a patch to clean the psql extended state at the start of
> >> every extended protocol backslash command, freeing the allocated
> >> variables and resetting the send_mode. Another possible approach would
> >> be to return an error when there's already an existing state instead
> >> of overwriting it.
> >
> > I'll double-check all that tomorrow, but you have looks like it is
> > going in the right direction.
>
> And done down to v16, with one logic for HEAD and something simpler
> for \bind in v16 and v17.
>
> Issuing an error if there is a state does not sound like a good idea
> at this stage because it would suddenly break scripts that expect
> multiple commands of \bind to prioritize the last one. If that was
> something only on HEAD, I would have considered that as a serious
> option, but not with v16 in mind for \bind.
> --
> Michael

Attachment Content-Type Size
v1-0001-psql-Add-test-for-repeated-bind-calls.patch text/x-patch 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2024-09-19 09:00:00 Re: Large expressions in indexes can't be stored (non-TOASTable)
Previous Message Andrei Lepikhov 2024-09-19 08:44:25 Re: Incremental Sort Cost Estimation Instability