Can I get the union of the a Postgres fulltext index?
If I understand your question correctly and it isnt at all clear, you are trying to pull back information as far as what id's are connected with a value.  I don't think you can just pull it from the index in PostgreSQL because the index will not contain visibility info, and so you will have a LOT of random IO and waiting for platters to turn.

The query for your test case is:

select thing, array_agg(id) from test group by thing;


Assuming you are on a version high enough to have array_agg.

In my system (9.1) this gives me:

chris=&gt; select thing, array_agg(id) from test group by thing;
   thing  | array_agg 
 ---------+-----------
  'one'   | {1,4}
  'two'   | {2,5}
  'three' | {3}
 (3 rows)


that's what you are looking for, right?