Is something like this possible without having to use WITH?
Can CREATE TEMP TABLE temp AS be used instead of creating the temp table manually?
CREATE TEMP TABLE temp ( action text, winery_id int, brand text ); MERGE INTO wines w USING wines_updates u ON u.winery_id = w.winery_id WHEN MATCHED THEN UPDATE SET stock = u.stock RETURNING merge_action() action, w.winery_id, w.brand INTO temp; Example DDL:
create table wines(winery_id int,brand text,stock int); insert into wines values (1,'Cheapaux',10) ,(2,'Mediocret Sauvignon',20) ,(3,'Expensivau Blanc',30); create table wines_updates(winery_id int,stock int); insert into wines_updates values (1,11) ,(2,22) ,(3,33);