Det här känns ganska klumpigt, men jag kan inte komma på en enklare lösning just nu:
with val (col) as (
values (ARRAY['CAT','CAT DOG CAT','DOG Cat'])
), word_list as (
select unnest(col) as pc
from val
), wc as (
select array_length(string_to_array(pc, ' '),1) as word_count, pc
from word_list
)
select array_agg(pc order by word_count desc)
from wc;