Re: [GENERAL] how to cancel a request in progress ?

From: Simon Drabble <simond(at)foxlink(dot)net>
To: Jonathan Davis <haj(at)idianet(dot)net>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] how to cancel a request in progress ?
Date: 1999-05-25 15:58:59
Message-ID: Pine.LNX.3.96.990525115140.26965B-100000@dragon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 25 May 1999, Jonathan Davis wrote:

> Simon Drabble wrote:
>
> > On Tue, 25 May 1999, Jonathan Davis wrote:
> >
> > > hello all
> > >
> > > is this possible to cancel a request in progress ?
> > >
> > >
> >
> > If you are using the interactive monitor, psql, try ctrl-c.
> >
> > If you are using the libpq or other interface, then it becomes much more
> > application specific, i.e. you might have to kill off the app.
> >
>
> but how do you kill a request in progress?
>
> I 'm using the libpq,.
>

Kill it off without killing the ap you mean? Unless your app is multi-threaded
or multi-process and uses IPC, you might not be able to.

You can use the asynch access functions within libpq, which will give control
back to your program. If you then decide at a later point that the database
command has not returned, you can kill it off if it is within a subthread or
subprocess (from a fork(), e.g.) but AFAIK there is no libpq or postgres
function to terminate a running command.

Actually it might be a better idea have your subprocess handle the db request
synchronously, and then the parent can time it out if it takes too long and
send a signal to the child to terminate it. This could be quite messy,
however, so if you are doing inserts or anything which affects a table's
contents, I would wrap it in a BEGIN..END transaction.

Simon.

--
"The world will end at Dec 31 1999 23:59:59. Please save your work and log
off before then or risk losing your data."

Simon Drabble Somewhere in cyberspace
simond(at)foxlink(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Simon Drabble 1999-05-25 16:22:12 Re: [GENERAL] how to cancel a request in progress ?
Previous Message Lincoln Spiteri 1999-05-25 15:57:47 Re: [GENERAL] Full Text Searches