Elinor <elinor(at)wise1(dot)tau(dot)ac(dot)il> writes:
> After many many minutes, it started giving these lines:
> server sent data ("D" message) without prior row description
> ("T" message)
Up till fairly recently (8.0 or maybe 7.4), libpq would do that if it
ran out of memory to hold the query result. I think you miswrote the
query and it's returning a huge number of rows. If you actually want
to fetch a huge number of rows, try using a cursor ...
regards, tom lane