"Recursive complex query" <gusta1308(at)gmail(dot)com> writes:
> and the server report me the error: "ERROR: write failed"
Maybe you ran out of disk space? Are you sure the recursion terminates
at all, or does so before generating an enormous number of rows?
regards, tom lane