Re: [GENERAL] how to cancel a request in progress ?
От | Simon Drabble |
---|---|
Тема | Re: [GENERAL] how to cancel a request in progress ? |
Дата | |
Msg-id | Pine.LNX.3.96.990525115140.26965B-100000@dragon обсуждение исходный текст |
Ответ на | Re: [GENERAL] how to cancel a request in progress ? (Jonathan Davis <haj@idianet.net>) |
Список | 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@foxlink.net
В списке pgsql-general по дате отправления: