[HACKERS] psql and named pipes

2008-03-27 Thread Alvaro Herrera
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

Re: [HACKERS] psql and named pipes

2008-03-27 Thread Aidan Van Dyk
* Alvaro Herrera [EMAIL PROTECTED] [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

Re: [HACKERS] psql and named pipes

2008-03-27 Thread Alvaro Herrera
Aidan Van Dyk wrote: I've had to use: while (true); do cat pipe; done | psql The trick is that pipes EOFs everytime the cleint closes it. (Not strictly true, but it appears that way to basic read()ers). Ah! Yeah, I knew that and forgot :-) It's easier than that actually -- you

Re: [HACKERS] psql and named pipes

2008-03-27 Thread Aidan Van Dyk
* Alvaro Herrera [EMAIL PROTECTED] [080327 13:51]: Ah! Yeah, I knew that and forgot :-) It's easier than that actually -- you just need to keep the pipe open in another process. So I can do this: first open a terminal with $ psql -f foo And then, in another terminal, $ cat foo

Re: [HACKERS] psql and named pipes

2008-03-27 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: 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