Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tvbxm-006JbB-Ot for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Mar 2025 12:59:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tvbxk-006bSb-RW for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Mar 2025 12:59:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tvbxk-006bSS-Hr for pgsql-bugs@lists.postgresql.org; Fri, 21 Mar 2025 12:59:00 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tvbxi-000Jks-1a for pgsql-bugs@lists.postgresql.org; Fri, 21 Mar 2025 12:58:59 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-30bf8632052so18975241fa.0 for ; Fri, 21 Mar 2025 05:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742561937; x=1743166737; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=wLpJldM2CL2sh1osfXbQgxRv286EM1fOkEEaHhgkPqM=; b=UrDCuDqd22iA+yvTo3AmS0Q7OeIjrUB3JhuWS1hMnvRLH9qWpAYRUcEyhqxzkXxTsF yHTlOX917GoZLfSXXvyKXc22LThabR4iCfKPXyl2MRJH4VQAtCH4QmO56eTuqDL39FR9 9yjwV0JQk20g1Ep3+t8USor6jrBls6YsfwdyqFRvJPwoZkDiF/Lex7WfRAybn7OCCYDq VVhGJ57QHqnrIafPKP358C2yiiPytco42sQgIWEaNpFSM7HKqXTBEB/lweBdF7t7o8Qr /RPvFjw8VckEZxvWJtcg/aCP3t/AG1Cp/HsE3SwM4cueGipeg+F5l92YeLTAFLzSErS8 kO5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742561937; x=1743166737; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wLpJldM2CL2sh1osfXbQgxRv286EM1fOkEEaHhgkPqM=; b=Jp0oKoKmX2d45c0Vp5584WB7pwYlDE6zYEODvgsRYT2VcDjRGxn4mj1NB4B+qEER+B Otne0fqHtVp+uyMETWkoNCVSikeTo/fN9bBafrFtalUoHUjDUvriA0HLxDot4fgDxo2L py8EoIVEsAOEBxSR6K08K2WblKMOtWrPGmuaGKMu8H7NJmD4Ss2/IKucvYz6sSVagJPi y9ko6n2mqbm+ojiB6KQJ1FPMFzO5pG1HkQ32U3etNGGJF2dhV/MHTiNw/ZH8cqm9t5Rd 2rh4CLHS1raeeyKZfOuAAybMdBFwgJbswR7cbuL1W9Xt6yKkBPLM5ZHGzSU9ac51xlFt 496w== X-Forwarded-Encrypted: i=1; AJvYcCWq7iDOiHYfqjRFTwrAveNnUll2kMREBE1FIBVr6XcoXPghAZ6zxcpWEJhytF7A+ORa13ArpPcOxnAT@lists.postgresql.org X-Gm-Message-State: AOJu0YxvtWQobphn+6dNeUDvQrRcGbqi9U/Esq12BWP4/NfHp/MNl1yP i3xNIfmZm/QIHm8MUAF49hvt3u/Y90CuH4tDjB9023qid7EwyZGPB1aTSW3Yd5Q= X-Gm-Gg: ASbGncsdP81UgS4FcQKR/pQDqGK4aBo9aB14G5R4H/XgNgqUeYLANkkbkUlsoBd82Nw dm1YpXQkhJ9u3f4+2cYDIEqX4OGII/d2nrJior3owqMClCBSPNjxEewJAQ3phYtbxzzI0A8Wf+2 LBKP8fiknK5WIb1VkxcuPXb9MHRVobyf2xsFuRpBNaYhzwxwj9l3GdXP0m68NYRGO1kP2YMFA0q 2l9ojBn1RMCGgO8Yubt9yUollhJ4B+qY4VPAytQXIhbx2wJLMhlM83sb0W/38qutwNIzc+XuxTQ iX5QICajIKdeCLPkLFJOWVMwFYb9R/YC/mFBJHxca2oLKZh3yYR59zMb0aZlpqw= X-Google-Smtp-Source: AGHT+IF84UnPLfPKEkN7RPYd02tmaMQmBjhtSNjutAsxoJ4ZgawYxXHgI8SPzvLSoxvlJRjAtJ9/LA== X-Received: by 2002:a05:651c:b14:b0:30b:badf:75f0 with SMTP id 38308e7fff4ca-30d7e1ef0b0mr12176851fa.2.1742561936289; Fri, 21 Mar 2025 05:58:56 -0700 (PDT) Received: from [10.225.143.200] ([85.184.94.138]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30d7d91052dsm2273741fa.90.2025.03.21.05.58.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Mar 2025 05:58:55 -0700 (PDT) Message-ID: <72c3c1f4-9ed1-4d1c-ae67-eb04b8e50cd1@gmail.com> Date: Fri, 21 Mar 2025 13:58:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18859: ERROR: unexpected plan node type: 356 To: splarv@ya.ru, pgsql-bugs@lists.postgresql.org, PG Bug reporting form References: <18859-0d5f28ac99a37059@postgresql.org> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: <18859-0d5f28ac99a37059@postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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