Mark Harrison <mh(at)pixar(dot)com> writes:
> res = PQexec(conn,"DECLARE cur CURSOR FOR select * from assets limit 8888"); printf("PQexec declare %s\n", PQresStatus(PQresultStatus(res)));
> PQclear(res);
> rc = PQsendQuery(conn, fetchstr);
> printf("PQsendQuery %d\n", rc);
> PQclear(res);
You just re-cleared an already cleared result. This probably caused a
double free, corrupting malloc's datastructures. The later crash within
malloc is not surprising...
regards, tom lane