Re: [HACKERS] Killing the backend to cancel a long waiting query

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Paulo Scardine <paulos(at)cimed(dot)ind(dot)br>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-odbc(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [HACKERS] Killing the backend to cancel a long waiting query
Date: 2003-09-18 23:46:13
Message-ID: 3F6A43C5.27871514@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces pgsql-odbc

Paulo Scardine wrote:
>
> 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?

Call SQLCancel().

regards,
Hiroshi Inoue
http://www.geocities.jp/inocchichichi/psqlodbc/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jenny Zhang 2003-09-19 00:52:41 Re: osdl-dbt3 run results - puzzled by the execution
Previous Message Matt Clark 2003-09-18 23:19:00 Re: osdl-dbt3 run results - puzzled by the execution plans

Browse pgsql-interfaces by date

  From Date Subject
Next Message Louise Cofield 2003-09-19 21:02:07 How to insert a string with single quotes in the text
Previous Message Tom Lane 2003-09-18 19:54:10 Re: Killing the backend to cancel a long waiting query

Browse pgsql-odbc by date

  From Date Subject
Next Message Hiroshi Inoue 2003-09-18 23:53:42 Re: Delphi7, ADO, ODBC and PostgreSQL connection problems:
Previous Message Hiroshi Inoue 2003-09-18 23:39:11 Re: SQLBrowseConnect: Invalid string or buffer length