Postgres cannot simulate table with a view: column must appear in the GROUP BY clause or be used in an aggregate function
Postgres is smart enough to know in the TABLE that your group-by column is UNIQUE (PRIMARY KEY) ... grouping by a column that is UNIQUE is pointless, so postgres just gives you back what you ask for (column values a and b)..

However, Postgres does NOT know that the group-by column in the VIEW is UNIQUE..  Thus, it's confused by your query (as well as most humans would be confused by your query - including myself).

FYI - your query makes no sense.  Why would you group by a column when you apparently have no interest in performing an aggregate?  What would you expect a and b to give you?