Re: WITH NOT MATERIALIZED and DML CTEs - Mailing list pgsql-hackers

From Elvis Pranskevichus
Subject Re: WITH NOT MATERIALIZED and DML CTEs
Date
Msg-id 12389707.kYbJWkIkHK@hammer.magicstack.net
Whole thread Raw
In response to Re: WITH NOT MATERIALIZED and DML CTEs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: WITH NOT MATERIALIZED and DML CTEs
List pgsql-hackers
On Monday, June 3, 2019 12:09:46 P.M. EDT Tom Lane wrote:
> > I understand why the rule exists in the first place, but I think
> > that an explicit opt-in signals the assumption of responsibility
> > and opens the possibility of using this in a well-defined
> > evaluation context, such as CASE WHEN.
> 
> TBH, if you think it's well-defined, you're wrong.

The documentation seems to strongly suggest otherwise:

"When it is essential to force evaluation order, a CASE construct (see 
Section 9.17) can be used. ... CASE construct used in this fashion will 
defeat optimization attempts"

Are there cases where this is not true outside of the documented 
exceptions (i.e. immutable early-eval and aggregates)?

                                 Elvis





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: WITH NOT MATERIALIZED and DML CTEs
Next
From: Tom Lane
Date:
Subject: Re: WITH NOT MATERIALIZED and DML CTEs