create table t  (
	j integer,
	k integer,
	a varchar
);
insert into t values (1, 1, 'a');
insert into t values (2, 2, 'b');
insert into t values (2, 3, 'c');
insert into t values (3, 4, 'A');
insert into t values (3, 5, 'B');
insert into t values (3, 6, 'C');
insert into t values (4, 7, 'a');
insert into t values (4, 8, 'b');
insert into t values (4, 9, 'c');
insert into t values (4, 0, 'a');

-- OK
select upper(a) as x, count(a) from t group by x;

-- OK
select k/2 as x, max(k) from t group by x;

-- OK
-- select k as x, max(j) from t group by x;

-- OK
select upper(a) as x, count(k), count(a) from t group by x;

-- CRASH
select k/2 as x, max(j) from t group by x;

-- CRASH
select upper(a) as x, count(k) from t group by x;

-- CRASH
select upper(a) as x, count(xmin) from t group by x;

-- CRASH
select upper(a) as x, count(oid) from t group by x;

-- CRASH
select upper(a) as x, count(*) from t group by x;
