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?.
6 rows affected
id | foo | bar |
---|---|---|
1 | 12 | 22 |
2 | 32 | 42 |
ERROR: column "t.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 2: DISTINCT ON (id) id,
^
id | foo | max_bar |
---|---|---|
1 | 10 | 22 |
2 | 30 | 42 |
id | foo | bar |
---|---|---|
1 | 12 | 22 |
2 | 32 | 42 |