dbdpg
dbdpg copied to clipboard
Fixed hangup of execution of queries like "COPY TO STDIN" in asynchronous mode.
The problem is in the wrong sequence of calls when processing the result of calling the COPY command in asynchronous mode. https://github.com/bucardo/dbdpg/issues/98
The problem is that the pg_db_result method tries to get the result of the query before it completes. The result of the COPY command will be only after the end of reading / writing the data stream.
Perhaps the problem can be solved differently, I did not want to change the source code much.
Do you have a working test script that demonstrates this? While digging in, I found some other issues with regards to async COPY so I want to make sure I fix it all at once.
A lot of time has passed, the server is already down. According to the results of experiments, I refused to use asynchronous COPY due to the fact that it did not speed up, but only saved memory (I had enough memory). Only test cases remained, which are also tied to task #98. https://github.com/bucardo/dbdpg/files/9491191/test.tgz
Thank you. I think we are simply going to disallow calling pg_result after an asynchronous COPY, as it's not the same as the non-COPY cases where we can simply wait for the server to finish.
In the current version of the module, if pg_result is not called after a successful pg_ready, an error will occur, since pg_result sets the status of waiting for data from COPY.