What I really want to do is have the token array available as a record so that I can query against it, but not have it take up the resources of a real table. If I could copy from an array into a record then I can even get rid of the loop. Anyone have any thoughts on how to do this?
You could make a set-returning-function (about 3 lines) which RETURNs NEXT every element in the array ; then you can use this SRF just like a table and SELECT from it, join it with your other tables, etc.
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match