add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
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?.
create table t (id int primary key not null, a int);
CREATE TABLE
insert into t (id, a) values (1, 100), (2, 200), (3, 260);
INSERT 0 3
select * from t;
id a
1 100
2 200
3 260
SELECT 3
select id, a from t group by id
id a
2 200
3 260
1 100
SELECT 3
select id, a from t group by a
ERROR:  column "t.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select id, a from t group by a
               ^