Re: psql client quits after 1st command

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: psql client quits after 1st command
Дата
Msg-id 20070302164717.GB30029@svana.org
обсуждение исходный текст
Ответ на Re: psql client quits after 1st command  (Vincenzo Romano <vincenzo.romano@gmail.com>)
Ответы Re: psql client quits after 1st command  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Add items to a record variable
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Differences in identical queries