Hello, > On OOM, the old result is freed to have higher chance that > constructing new result succeeds. But if we want to transport > error message, we need to keep old PGresult around. Thus > two separate paths.
Ok, I understood the aim. But now we can use non-local exit to do that for not only asynchronous reading (PQgetResult()) but synchronous (PQexec()). If we should provide a means other than exceptions to do that, I think it should be usable for both syncronous and asynchronous reading. conn->asyncStatus seems to be used for the case. Wow is the modification below? - getAnotherTuple() now returns 0 to continue as before, and 1 instead of EOF to signal EOF state, and 2 to instruct to exit immediately. - pqParseInput3 set conn->asyncStatus to PGASYNC_BREAK for the last case, - then PQgetResult() returns immediately when asyncStatus == PGASYNC_TUPLES_BREAK after parseInput() retunes. - and PQexecFinish() returns immediately if PQgetResult() returns with aysncStatys == PGASYNC_TUPLES_BREAK. - PGgetResult() sets asyncStatus = PGRES_TUPLES_OK if called with asyncStatus == PGRES_TUPLES_BREAK - New libpq API PQisBreaked(PGconn*) returns if asyncStatus == PGRES_TUPLES_BREAK can be used to check if the transfer is breaked. > Instead use ("%s", errmsg) as argument there. libpq code > is noisy enough, no need to add more. Ok. I will do so. regards, -- Kyotaro Horiguchi NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers