If you really want to involve text search, have a look at ts_parse()
.
SELECT token
FROM ts_parse('default', 'The slow brown fox jumps over the quick dog at Friday')
WHERE tokid != 12 -- blank
EXCEPT
SELECT token
FROM ts_parse('default', 'The quick brown fox jumps over the lazy dog')
WHERE tokid != 12 -- blank
-- will give you
"token"
--------
'slow'
'at'
'Friday'
Or, you can use regular expressions for that:
SELECT *
FROM regexp_split_to_table('The slow brown fox jumps over the quick dog at Friday', '\s+')
EXCEPT
SELECT *
FROM regexp_split_to_table('The quick brown fox jumps over the lazy dog', '\s+')
At the end, use array_agg()
to accumulate the results into an array, if necessary.