On 2 November 2017 at 01:14, Alvaro Herrera wrote:
> Nico Williams wrote:
>
>> As an aside, I'd like to be able to control which CTEs are view-like and
>> which are table-like. In SQLite3, for example, they are all view-like,
>> and the optimizer will act accordingly, whereas in PG they are all
>
Nico Williams wrote:
> As an aside, I'd like to be able to control which CTEs are view-like and
> which are table-like. In SQLite3, for example, they are all view-like,
> and the optimizer will act accordingly, whereas in PG they are all
> table-like, and thus optimizer barriers.
There was a sho
Is it possible to map MERGE onto a query with CTEs that does the the
various DMLs, with all but the last RETURNING? Here's a sketch:
WITH matched_rows AS (
SELECT FROM t WHERE
),
updated_rows AS (
UPDATE t
SET ...
WHERE ... AND t in (SELECT j FROM matc