Following command works fine :
select count(*) * 2 from rooms;
But if I am trying to do something like :
select count(*) * array_length(students,1) from rooms;
where students
is an array column in the table rooms
. Following error is thrown :
ERROR: column "rooms.students" must appear in the GROUP BY clause or be used in an aggregate function
SQL state: 42803
Character: 32
What is the right way to get the desired result?