Re: psql -e

From: nolan(at)celery(dot)tssi(dot)com
To: mallah(at)trade-india(dot)com (Rajesh Kumar Mallah)
Cc: peter_e(at)gmx(dot)net (Peter Eisentraut), pgsql-general(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: psql -e
Date: 2003-07-24 14:39:31
Message-ID: 20030724143933.9793.qmail@celery.tssi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > The query is printed *before* it is executed, but you might not see it
> > because your terminal is not flushing the stdout at the right times.
>
> thanks ,
> shud there be a fflush then after that print?
> or there is something i can do on the shell itself?

I've been looking into the echo feature, especially as it relates
to the \o feature, and there are several places where an fflush
would be helpful so that the output appears on a timely basis and always
appears in the same order if readline is being used, because
readline appears to maintain an independent output buffer.

I made the changes for me in 7.3.3 to add some missing fflush's and also
changed it so that if echo queries and \o are both on, then the query
is echoed to the output file.

I can probably create diffs for 7.3.3 if you want them.

This was before I got cvs working here, so I have not yet tried these
patches in 7.4. I've been holding back in part because of the 7.4 feature
freeze period (though that might not be enough of a feature change
to raise eyebrows), and also because there appears to be some readline
complications. For example, if you try to backspace you can get some
weird looking terminal output.

The output sections of psql should probably be rewritten to ensure it
doesn't intermingle output. It may be desirable to use parallel
streams to the console and to an output file (if defined), but that was
a bit more than I wanted to bite off as my first project at the time.

Tom, would rewriting the output sections interfere with any changes
you are/were working on in psql? I probably won't have time to work on
this before August 15th at this point, so maybe I should wait until we're
ready to start on 7.5 stuff, in which case I may propose several changes
in the definitions and options for both the echo and output options
in psql.
--
Mike Nolan

In response to

  • Re: psql -e at 2003-07-24 10:42:06 from Rajesh Kumar Mallah

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-07-24 14:42:24 Re: psql -e
Previous Message Thien-Thi Nguyen 2003-07-24 14:29:36 quoting of array elements + sexp_out?