Re: BUG #16653: Regression in CTE evaluation

From: Cherio <cherio(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16653: Regression in CTE evaluation
Date: 2020-10-04 22:19:40
Message-ID: CAKHqFkL74cAWN=Xh6657SXPS926DsAeb6Sddzbtyf5QXtPnBcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I guess I was too quick to characterize it as "regression" which implies a
bug. It is certainly a behavior change that affects already written and
tested to work queries.

On Sun, Oct 4, 2020 at 1:36 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > On Sun, Oct 4, 2020 at 04:18:43PM +0000, PG Bug reporting form wrote:
> >> The following SQL worked in versions 9 through 12. It is throwing an
> error
> >> in version 13.
>
> > Uh, I am able to reproduce the error in PG _12_ as well, and I am sure
> > it is related to this change in PG 12:
>
> > Allow common table expressions (CTEs) to be inlined into the outer
> query
> > (Andreas Karlsson, Andrew Gierth, David Fetter, Tom Lane)
>
> Indeed. The planner now inlines the WITH query, allowing
> "CAST(exp_days.days || ' days' AS interval)" to be folded to a constant,
> whereupon you get an error since indeed ' days' isn't valid interval
> input.
>
> Sorry, I reject the position that this is a bug. It was something of
> an implementation artifact that you didn't get this error before.
> As of v12, we provide explicit control over whether a WITH query can
> be inlined or not, and you need to use that control if you have a
> query that's dependent on inlining not happening.
>
> regards, tom lane
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Max Vikharev 2020-10-05 09:23:21 Re: BUG #16620: Autovacuum does not process certain databases after migration from postgresql 10
Previous Message Tom Lane 2020-10-04 17:36:29 Re: BUG #16653: Regression in CTE evaluation