Re: Wrong unsafe-flag test in check_output_expressions()

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wrong unsafe-flag test in check_output_expressions()
Date: 2026-06-02 20:59:17
Message-ID: CAApHDvpb8nHDXF+ZS4BG=k=-4ykVpP6EYtsV7=rjNezun8CrQg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 1 Jun 2026 at 20:27, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> I happened to notice $subject when working on a bug-fix near-by.
>
> /* If subquery uses window functions, check point 4 */
> if (subquery->hasWindowFuncs &&
> (safetyInfo->unsafeFlags[tle->resno] &
> UNSAFE_NOTIN_DISTINCTON_CLAUSE) == 0 &&
> !targetIsInAllPartitionLists(tle, subquery))
> {
> /* not present in all PARTITION BY clauses, so mark it unsafe */
> safetyInfo->unsafeFlags[tle->resno] |= UNSAFE_NOTIN_PARTITIONBY_CLAUSE;
> continue;
> }

Yes, that's not intentional. Your proposed fix looks correct. Are you
happy to go ahead with pushing and backpatching that?

Wondering, did you spot that with eyes or tool assist?

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-06-02 21:05:19 Re: Vacuumlo improvements
Previous Message Zsolt Parragi 2026-06-02 20:56:40 Re: Fix bug of CHECK constraint enforceability recursion