mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #65919 from kitaisreal/postgresql-source-cancel-query-comments
PostgreSQL source cancel query comments
This commit is contained in:
commit
ad798196e9
@ -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