mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
PostgreSQL source cancel query comments
This commit is contained in:
parent
5a6e6d3c5d
commit
c43ce89a62
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user