Re: psql client quits after 1st command - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: psql client quits after 1st command
Date
Msg-id 20070302164717.GB30029@svana.org
Whole thread Raw
In response to Re: psql client quits after 1st command  (Vincenzo Romano <vincenzo.romano@gmail.com>)
Responses Re: psql client quits after 1st command
List pgsql-general
On Fri, Mar 02, 2007 at 05:26:03PM +0100, Vincenzo Romano wrote:
> > psql gets an EOF on the named pipe when the first shell command
> > exits.  You need to batch all your commands and send them in one shell
> > command, so it keeps the pipe open until it's done.
> >
> > -Doug
>
> Using "echo -n" instead of the plain "echo" to avoid sending the EOL makes the
> psql client behaving the same way: quitting after the first complete command.
> This makes useless the input redirection from anything other than a file.

No, it's exactly as he said: the FIFO only works once. As soon as
you've piped something into it and the echo closes the pipe, it closes
for psql also. As far as it's concerned you've quit, so it exits.

Replace the psql commmand with "cat" and you'll see exactly the same
effect.

I don't think you can acheive the effect you want with a FIFO. Maybe a
UDP socket will work as it doesn't require a permanent connection.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Add items to a record variable
Next
From: Richard Huxton
Date:
Subject: Re: Differences in identical queries