By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
begin;
create temp table a2(col1 text, col2 text, col3 text);
insert into a2(col1,col2,col3) values
('a','abc' , 'rejected'),
('a', 'def',null ),
('b' , 'etg' , 'accepted'),
('c', 'jfh',null);
commit;
table a2;
4 rows affected
col1 | col2 | col3 |
---|---|---|
a | abc | rejected |
a | def | null |
b | etg | accepted |
c | jfh | null |
update a2 set
col3 =
case when col1 = 'a' then 'rejected'
when col1 = 'b' then 'accepted'
when col1 = 'c' then 'null' end
where col3 is null
returning *;
col1 | col2 | col3 |
---|---|---|
a | def | rejected |
c | jfh | null |
drop table a2 cascade ;