I saw this example in postgresql guide:
WITH t AS (
DELETE FROM foo
)
DELETE FROM bar;
The manual says:
This example would remove all rows from tables foo and bar. The number of affected rows reported to the client would only include rows removed from bar.
Why would it delete from foo if I didn't "call" t?
Normaly with is used like:
WITH t AS (
UPDATE products SET price = price * 1.05
RETURNING *
)
SELECT * FROM t;
There is an actuall call to t which only then "summons" the with block.
Can someone explain this?