jamie=# select a+1 from nums group by a+1;
?column?
----------
2
4
1
3
(4 rows)
jamie=# select a+1 from nums group by 1+a;
ERROR: column "nums.a" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select a+1 from nums group by 1+a;
^

jamie=# (select a from nums) order by b;
a
---
3
0
1
2
(4 rows)
jamie=# ((select a from nums) union (select a from nums)) order by b;
ERROR: column "b" does not exist
LINE 1: ...(select a from nums) union (select a from nums)) order by b;

jamie=# select b from nums group by a;
b
---
(0 rows)
jamie=# select a from nums group by b;
ERROR: column "nums.a" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select a from nums group by b;