Re: Writeable CTEs and side effects - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: Writeable CTEs and side effects
Date
Msg-id 4ACDDDAA.20808@cs.helsinki.fi
Whole thread Raw
In response to Writeable CTEs and side effects  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
List pgsql-hackers
I wrote:
> 3)    WITH t1 AS
>     (UPDATE foo SET bar=bar+1 RETURNING *),
>     t2 AS
>     (UPDATE baz SET bat=bat+1 RETURNING *)
>     VALUES (true);
> 
> This isn't probably the most common situation either, but I think it's
> worth looking at; the user wants to update two different tables, but
> ignore the RETURNING data completely.  On IRC, this has been requested
> multiple times.  Even if we wouldn't agree that this feature is useful,
> it pretty much follows the semantics of example #1.

A bit off topic, but IMHO if we allow this case, we could allow
INSERT/UPDATE/DELETE without a RETURNING clause if the CTE isn't
referenced, so you could write this as:

WITH t1 AS
(UPDATE foo SET bar=bar+1),
t2 AS
(UPDATE baz SET bar=bar+1)
VALUES(true);


Regards,
Marko Tiikkaja



pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: COPY enhancements
Next
From: Robert Haas
Date:
Subject: Re: COPY enhancements