pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Zhang Mingli <zmlpostgres@gmail.com>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18778: Query planning fails in ExecInitExprRec with unrecognized node type
Date: Sat, 18 Jan 2025 11:51:37 -0500
Message-ID: <2550569.1737219097@sss.pgh.pa.us> (raw)
In-Reply-To: <dc467c76-e5e5-4eaf-950b-32097f32d4f2@Spark>
References: <18778-24cd399df6c806af@postgresql.org>
	<1919554.1737070534@sss.pgh.pa.us>
	<dc467c76-e5e5-4eaf-950b-32097f32d4f2@Spark>

Zhang Mingli <zmlpostgres@gmail.com> writes:
> And I have a question that may not be directly related to the issue: why is there a Subplan 2, and it appears to be unused?

Yeah, that's because the AlternativeSubPlan originally had two child
subplans: a parameterized one intended for a few calls, and a hashed
one to be used for a lot of calls.  We build both because at the time
when this needs to happen, we don't have any clue how many calls
there will be.  We wait till the very end of planning to decide which
one is more likely to win based on context, and then discard the
AlternativeSubPlan, replacing it with a direct reference to the chosen
SubPlan.  But the other one stays in the tree.  Getting rid of it
seemed complicated, and it won't be referenced at runtime so there's
not much penalty from leaving it there.  It is confusing, I admit.

			regards, tom lane





view thread (4+ messages)

Message-ID: <2550569.1737219097@sss.pgh.pa.us>
Permalink:  ../2550569.1737219097@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2550569.1737219097@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, zmlpostgres@gmail.com, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18778: Query planning fails in ExecInitExprRec with unrecognized node type
  In-Reply-To: <2550569.1737219097@sss.pgh.pa.us>

* 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