Re: WITH NOT MATERIALIZED and DML CTEs

From: David Fetter <david(at)fetter(dot)org>
To: Elvis Pranskevichus <elprans(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WITH NOT MATERIALIZED and DML CTEs
Date: 2019-06-03 23:14:28
Message-ID: 20190603231428.GQ12249@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 03, 2019 at 11:45:51AM -0400, Elvis Pranskevichus wrote:
> Currently, WITH a AS NOT MATERIALIZED (INSERT ...) would silently
> disregard the "NOT MATERIALIZED" instruction and execute the data-
> modifying CTE to completion (as per the long-standing DML CTE rule).
>
> This seems like an omission to me. Ideally, the presence of an explicit
> "NOT MATERIALIZED" clause on a data-modifying CTE should disable the
> "run to completion" logic.

It might be worth documenting the fact that NOT MATERIALIZED doesn't
affect DML CTEs, just as it doesn't affect statements with volatile
functions and recursive CTEs.

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-06-03 23:33:35 Re: WITH NOT MATERIALIZED and DML CTEs
Previous Message Tom Lane 2019-06-03 22:36:06 Re: Use of multi-column gin index