Re: psql client quits after 1st command

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Subject: Re: psql client quits after 1st command
Date: 2007-03-05 08:12:32
Message-ID: 200703050912.33414.Vincenzo.Romano@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Good point Tom.

I failed to go little deeper in the problem.
So the final test for me is that the whole bash script along
with its echos is to be globally directed to the pipes.

On Friday 02 March 2007 19:43 Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> > I don't think you can acheive the effect you want with a FIFO.
>
> I think Doug had it right: the trick is to have some process holding the
> FIFO open for write throughout the procedure, so that the reader (psql)
> doesn't see an EOF. This doesn't necessarily have to be the same
> process(es) that're actually putting data into the FIFO.
>
> Per the read(2) man page:
>
> When attempting to read from an empty pipe or FIFO:
>
> o If no process has the pipe open for writing, read() will
> return 0 to indicate end-of-file.
>
> o If some process has the pipe open for writing and O_NONBLOCK
> is set, read() will return -1 and set errnoto EAGAIN.
>
> o If some process has the pipe open for writing and O_NONBLOCK
> is clear, read() will block until some data is written or the
> pipe is closed by all processes that had the pipe open for
> writing.
>
> regards, tom lane

--
Vincenzo Romano
----
Maybe Computers will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1987]

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2007-03-05 08:35:42 Re: Can I getting a unique ID from a select
Previous Message hubert depesz lubaczewski 2007-03-05 08:05:51 Re: usage for 'with recursive'?