Re: Fix error handling in getCopyDataMessage and pqFunctionCall3

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
Cc: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix error handling in getCopyDataMessage and pqFunctionCall3
Date: 2026-07-23 07:43:26
Message-ID: CAHGQGwEnr1ssYoGqLReWh+aJwRbgYcNJGAMHWSg_+913n5AXtg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 23, 2026 at 4:02 PM Ewan Young <kdbase(dot)hack(at)gmail(dot)com> wrote:
> +1 from me.

+1

I have one comment:

/* Completed parsing this message, keep going */
pqParseDone(conn, conn->inStart + 5 + msgLength);
needInput = false;
+
+ /*
+ * An error may have been triggered while processing the message, bail
+ * out
+ */
+ if (conn->error_result && conn->status == CONNECTION_BAD)
+ return pqPrepareAsyncResult(conn);

getCopyDataMessage() checks for the fatal error before pqParseDone(),
but pqFunctionCall3() does it after pqParseDone(). Shouldn't
pqFunctionCall3() use the same ordering?

If getNotify() or getParameterStatus() calls handleFatalError(), the input
buffer has already been flushed, so calling pqParseDone() afterwards seems
unnecessary and a bit confusing.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-07-23 08:06:25 Re: Don't use pq_putmessage in socket comm function
Previous Message Zsolt Parragi 2026-07-23 07:33:57 pg_resetwal: do not allow zero next multixact offset