X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8552BD1B51D; Thu, 18 Sep 2003 18:06:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14504-04; Thu, 18 Sep 2003 15:05:54 -0300 (ADT) Received: from angelica (unknown [200.161.129.200]) by svr1.postgresql.org (Postfix) with ESMTP id CCFE7D1B508; Thu, 18 Sep 2003 15:05:52 -0300 (ADT) Received: from [192.168.1.97] (helo=Paulo) by angelica with smtp (Exim 3.36 #1 (Debian)) id 1A03Qt-0007jJ-00; Thu, 18 Sep 2003 15:23:11 -0300 Message-ID: <007701c37e0f$4fc1b550$6101a8c0@Paulo> From: "Paulo Scardine" To: Cc: , References: <2054.1063808792@sss.pgh.pa.us> <3F69A6DE.1050002@bigfoot.com> Subject: Killing the backend to cancel a long waiting query Date: Thu, 18 Sep 2003 15:04:32 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/46 X-Sequence-Number: 4464 There are many interfaces that doesn't support canceling a long query other than killing the application or killing the backend using the server operational system. I've searched the docs, faqs and list archives; seen a lot of questions but no answers. So I hacked a small pggetpid and pgkillpid C functions, and now I can learn the backend's PID, start the query in a new thread, and kill the backend using another connection if I want. Its ugly, I know, but worked wonderfully with ODBC, the Delphi developers here and the users are very happy. Questions are: 1) is there a better way to do that? 2) is it safe to kill the backend this way (other than an user killing the wrong postgres owned proccess)? 3) is this useful for anyone else? Regards, -- Paulo Scardine