PostgreSQL source cancel query comments

This commit is contained in:
Maksim Kita 2024-07-01 16:27:10 +03:00
parent 5a6e6d3c5d
commit c43ce89a62

View File

@ -193,7 +193,15 @@ PostgreSQLSource<T>::~PostgreSQLSource()
{
if (stream)
{
/** Internally libpqxx::stream_from runs PostgreSQL copy query `COPY query TO STDOUT`.
* During transaction abort we try to execute PostgreSQL `ROLLBACK` command and if
* copy query is not cancelled, we wait until it finishes.
*/
tx->conn().cancel_query();
/** If stream is not closed, libpqxx::stream_from closes stream in destructor, but that way
* exception is added into transaction pending error and we can potentially ignore exception message.
*/
stream->close();
}