From: Andrei Lepikhov <lepihov@gmail.com>
To: splarv@ya.ru, pgsql-bugs@lists.postgresql.org, PG Bug reporting form <noreply@postgresql.org>
Subject: Re: BUG #18859: ERROR: unexpected plan node type: 356
Date: Fri, 21 Mar 2025 13:58:54 +0100
Message-ID: <72c3c1f4-9ed1-4d1c-ae67-eb04b8e50cd1@gmail.com> (raw)
In-Reply-To: <18859-0d5f28ac99a37059@postgresql.org>
References: <18859-0d5f28ac99a37059@postgresql.org>
On 20/3/2025 14:53, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18859
> Logged by: Olleg Samoylov
> Email address: splarv@ya.ru
> PostgreSQL version: 17.4
> Operating system: RedOS 8
> Description:
>
> This working.
> postgres=> do $$ declare p_CurData refcursor; begin OPEN p_CurData FOR
> SELECT NULL::int id; end;$$;
> DO
> But this is not. Internal error.
> postgres=> do $$ declare p_CurData refcursor; begin OPEN p_CurData SCROLL
> FOR SELECT NULL::int id; end;$$;
> ERROR: unexpected plan node type: 356
> CONTEXT: PL/pgSQL function inline_code_block line 1 at OPEN
>
It may be reproduced with any expression, treated as a simple
expression. For example:
DO $$
DECLARE
p_CurData refcursor;
BEGIN
OPEN p_CurData SCROLL FOR SELECT now();
END; $$;
The problem here is in the scrollable cursors code which inserts
Material node:
if (cursorOptions & CURSOR_OPT_SCROLL)
{
if (!ExecSupportsBackwardScan(top_plan))
top_plan = materialize_finished_plan(top_plan);
}
But the exec_save_simple_expr() doesn't process Material node and causes
the ERROR.
--
regards, Andrei Lepikhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: lepihov@gmail.com, noreply@postgresql.org
Subject: Re: BUG #18859: ERROR: unexpected plan node type: 356
In-Reply-To: <72c3c1f4-9ed1-4d1c-ae67-eb04b8e50cd1@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox