From: | Aidan Van Dyk <aidan(at)highrise(dot)ca> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: psql and named pipes |
Date: | 2008-03-27 17:05:17 |
Message-ID: | 20080327170517.GR6497@yugib.highrise.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
* Alvaro Herrera <alvherre(at)commandprompt(dot)com> [080327 12:58]:
> I was under the impression that I could start a "psql -f pipe" and then
> feed it commands through the pipe using echo, and expect it to hang from
> one command to the next. Of course, this doesn't work -- my guess is
> that echo sends an EOF after the line I send, so psql sees the EOF in
> the pipe and terminates.
>
> Does anyone have an idea how to go about this? I was expecting to be
> able to drive two psql sessions in parallel in a shell script -- sort of
> poor man's concurrent psql :-(
I've had to use:
while (true); do cat pipe; done | psql
The trick is that pipes "EOF"s everytime the cleint closes it. (Not
strictly true, but it appears that way to basic read()ers).
You can see a more compilcated setup I use to echo commands to a pipe
going to a psql here:
http://www.highrise.ca/aidan/postgresql/watchsql
--
Aidan Van Dyk Create like a god,
aidan(at)highrise(dot)ca command like a king,
http://www.highrise.ca/ work like a slave.
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2008-03-27 17:30:14 | Re: Windows shared_buffers limitations |
Previous Message | Alvaro Herrera | 2008-03-27 16:56:39 | psql and named pipes |