Assert failure on running a completed portal again

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Assert failure on running a completed portal again
Date: 2024-12-05 21:25:49
Message-ID: 20241206062549.710dc01cf91224809dd6c0e1@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I notice that the following Assert in PortalRun fails when a same portal is
executed more than once by an Execute message whose "max number of rows"
is specified to zero, that is, "no limit".

/* Set run_once flag. Shouldn't be clear if previously set. */
Assert(!portal->run_once || run_once);
portal->run_once = run_once;

I tested this using pgproto [1] in Pgpool-II.

I believe the server should return CommanComplete normally in this case.
his can be fixed by not setting execute_is_fetch flag (run_once as the result)
when the portal is already completed since no rows will be fetched in this case.
I've attached a pach in this approach.

[1] https://www.pgpool.net/docs/latest/en/html/pgproto.html

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
0001-Prevent-Assert-failure-when-a-completed-portal-is-ru.patch text/x-diff 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2024-12-05 21:40:40 Re: Assert failure on running a completed portal again
Previous Message Peter Smith 2024-12-05 21:14:28 Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY