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?.
SELECT 5
colxx | colyy |
---|---|
a | 1 |
a | 2 |
a | 3 |
b | 4 |
c | 5 |
SELECT 5
sum | sum |
---|---|
9 | 9 |
SELECT 1
ERROR: column "t.colxx" must appear in the GROUP BY clause or be used in an aggregate function LINE 2: select (case when colxx in ('b', 'c') then sum(colyy) end) ^
colxx | case |
---|---|
a | null |
b | 4 |
c | 5 |
SELECT 3