Re: Wrong results from a parameterized Append

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wrong results from a parameterized Append
Date: 2026-10-09 19:13:06
Message-ID: 2861918.1791573186@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here's a v2 patch incorporating the cosmetic changes I suggested,
and substantially enlarging the comments around the area.
I don't think we're ready to commit though, because I see a number
of loose ends.

I looked through the code and confirmed that ppi_rows is used only
as per the new comments, and that the mistake you found in
get_memoize_path() is the only unsafe use of ppi_serials.
However, there are a number of places in the memoize logic that
think they can use ppi_clauses, which seems about as unsafe.
I think that'll at worst cause some missed optimization chances,
but I'm not entirely certain.

Another interesting point is that Gather and GatherMerge are treated
like baserel paths, although what's under them might be a join or
append. This might be okay but I'm not quite convinced there either.
At least we probably should document this somewhere.

The fact that create_append_path sometimes uses
get_baserel_parampathinfo isn't reflected in my new comments either,
and I wonder if the fact that it does isn't breaking
get_param_path_clause_serials.

regards, tom lane

Attachment Content-Type Size
v2-0001-Look-through-wrapper-paths-when-collecting-enforc.patch text/x-diff 19.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kacper Kuras 2026-10-09 19:13:59 Re: Proposal: SELECT * EXCLUDE (...) command
Previous Message Marcos Pegoraro 2026-10-09 19:04:22 Re: Proposal: SELECT * EXCLUDE (...) command