Re: [HACKERS] psql problem

From: Chris Bitmead <chrisb(at)nimrod(dot)itg(dot)telstra(dot)com(dot)au>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] psql problem
Date: 2000-02-17 04:44:07
Message-ID: 38AB7C96.F0F1F37F@nimrod.itg.telecom.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


There are two issues. One is what happens when there is something
in the buffer and I hit ^C. Intuitively I think I should get back to
a "sane" state ready for a new query. I mean I start off typing
a long query, then I change my mind I want ^C to get me a
clear prompt.

What used to happen is it says "CANCEL request sent". Then I
think "ok I'll put in a different query". but that doesn't work.
Maybe \r was the correct command but I never took the time
to learn that.

The other issue is what happens if I'm just at a prompt, I don't
think it should exit on ^C. Basicly this is because I'm familiar
with the way /bin/sh works and I wish psql had the same semantics.

Tom Lane wrote:
>
> >> What? Are you saying that control-C doesn't do a \r (reset the
> >> query buffer)? That's probably true, and I agree that it should...
>
> > Looks like it works fine:
>
> > test=> select * from pg_class, pg_proc;
> > ^C
> > Cancel request sent
> > ERROR: Query was cancelled.
> > test=>
>
> No, I think Chris was complaining about the behavior with an
> incomplete query in the buffer. I can't show it with current
> sources since psql is exiting on ^C, but 6.5 works like this:
>
> play=> foobar
> play-> ^C
> CANCEL request sent
> <-- return typed here to get a prompt
> play-> select 2+2;
> ERROR: parser: parse error at or near "foobar"
> play=>
>
> Notice the prompt correctly shows that I still have stuff in the
> query buffer after ^C. I think Chris is saying that ^C should
> flush the buffer like \r does ... and I agree.
>
> regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-02-17 05:40:32 Re: [HACKERS] create database doesn't work well in MULTIBYTE mode
Previous Message Christof Petig 2000-02-17 04:08:08 Re: [HACKERS] function question yet again