Postgres. Query kill button crashes Heidi.

[expired user #8249]'s profile image [expired user #8249] posted 10 years ago in General Permalink
Heidi issues a KILL statement but there is no KILL in PostgreSQL.
This forum post relates to the issue.
http://stackoverflow.com/questions/11291456/heroku-postgres-terminate-hung-query-idle-in-transaction

Current version 4820
[expired user #8249]'s profile image [expired user #8249] posted 10 years ago Permalink
This is rather a nasty issue as it hangs this machine entirely and requires a hard re-boot.
I think the KILL statement takes the Postgres server down altogether.
At present, don't use the kill button to try and terminate a hung query when using PG. Better still make sure your queries are complete before you issue them.
I am something of a novice here and I can only learn from my own mistakes.
Heidi is a great tool and a credit to it's authors.
ansgar's profile image ansgar posted 10 years ago Permalink
Is there some similar query in PostgreSQL to cancel a query?
ansgar's profile image ansgar posted 10 years ago Permalink
... or to disconnect a session?
[expired user #8249]'s profile image [expired user #8249] posted 10 years ago Permalink
Is this of any help here?
http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE
ansgar's profile image ansgar posted 10 years ago Permalink
I'll give it a try.
Code modification/commit from ansgar.becker, 10 years ago, revision 8.3.0.4823
Support query cancel button on PostgreSQL. See http://www.heidisql.com/forum.php?t=16402
ansgar's profile image ansgar posted 10 years ago Permalink
Try r4823
[expired user #8249]'s profile image [expired user #8249] posted 10 years ago Permalink
Thanks Ansgar, that seems to solve the issue.
[expired user #8121]'s profile image [expired user #8121] posted 10 years ago Permalink
Please note '<IDLE> in transaction' is/might be a valid state.
It means some transaction has been opened but no query is executed.

It's enough to send BEGIN statement to turn current connection into '<IDLE> in transaction'. In normal conditions, using COMMIT or ROLLBACK should be enough.

but if something went wrong (might be some automated process or so) since there is no query, you cannot cancel query using pg_cancel_backend(pid). You have to use pg_terminate_backend(pid). But it kills connection between client and database.

Please login to leave a reply, or register at first.