Re: psql -e - Mailing list pgsql-general

From nolan@celery.tssi.com
Subject Re: psql -e
Date
Msg-id 20030724143933.9793.qmail@celery.tssi.com
Whole thread Raw
In response to Re: psql -e  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Responses Re: psql -e  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: psql -e  (Dennis Gearon <gearond@cvc.net>)
List 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

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: List last value of all sequences
Next
From: Thien-Thi Nguyen
Date:
Subject: quoting of array elements + sexp_out?