BTW, I noticed while poking at this that the 2-arg form of ts_rewrite()
is labeled proretset = true in pg_proc.h. This must be a typo, since
a moment's glance at the code shows it cannot return a set. Good thing
we didn't ship beta2 yet ...
regards, tom lane