Unix Technical Forum

sigint psql

This is a discussion on sigint psql within the pgsql Hackers forums, part of the PostgreSQL category; --> I'm communicating with psql via a pipe stream. This works pretty well, but one problem I have is trying ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 02:46 AM
John DeSoi
 
Posts: n/a
Default sigint psql

I'm communicating with psql via a pipe stream. This works pretty well,
but one problem I have is trying to cancel an operation. If I send a
sigint, psql dies. In looking at the source I gather this is because it
assumes I'm in non-interactive mode (pset.notty is true). I was
wondering if there was some way to work around this short of
recompiling the source. I need to do the same thing on Windows.

Thanks for any suggestions,


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 02:46 AM
Doug McNaught
 
Posts: n/a
Default Re: sigint psql

John DeSoi <desoi@pgedit.com> writes:

> I'm communicating with psql via a pipe stream. This works pretty well,
> but one problem I have is trying to cancel an operation. If I send a
> sigint, psql dies. In looking at the source I gather this is because
> it assumes I'm in non-interactive mode (pset.notty is true). I was
> wondering if there was some way to work around this short of
> recompiling the source. I need to do the same thing on Windows.
>
> Thanks for any suggestions,


On Unix you could run 'psql' through a pty rather than a pipe. No
idea what the Windows equivalent would be.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 02:48 AM
Bruce Momjian
 
Posts: n/a
Default Re: sigint psql

Doug McNaught wrote:
> John DeSoi <desoi@pgedit.com> writes:
>
> > I'm communicating with psql via a pipe stream. This works pretty well,
> > but one problem I have is trying to cancel an operation. If I send a
> > sigint, psql dies. In looking at the source I gather this is because
> > it assumes I'm in non-interactive mode (pset.notty is true). I was
> > wondering if there was some way to work around this short of
> > recompiling the source. I need to do the same thing on Windows.
> >
> > Thanks for any suggestions,

>
> On Unix you could run 'psql' through a pty rather than a pipe. No
> idea what the Windows equivalent would be.


We don't have signals on win32 like we have on Unix so we simulate them.
Not sure it is possible to signal psql like you want on Win32.

I just tried 'kill -2 _psql_pid_' on unix and it did cancel the current
query.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com