edb=# select * from bentley ;
id | value
-------+-------
cm1 | foo
cm1-1 |
cm1-2 |
cm2 | bar
cm2-1 |
(5 rows)
edb=*# with x as (select id, value from bentley where value is not null) update bentley set value = x.value from x where bentley.id ~ x.id and bentley.value is null;
UPDATE 3
edb=*# select * from bentley ;
id | value
-------+-------
cm1 | foo
cm2 | bar
cm1-1 | foo
cm1-2 | foo
cm2-1 | bar
(5 rows)
edb=*#