edb=*# drop table demo;
DROP TABLE
edb=*# create table demo (a int, b int, c int);
CREATE TABLE
edb=*# insert into demo values (2,3,4);
INSERT 0 1
edb=*# with tmp as (select a+b as ab, b+c as bc, a+c as ac from demo) select ab+bc+ac from tmp;
?column?
----------
18
(1 row)
edb=*#