psql client quits after 1st command

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: psql client quits after 1st command
Date: 2007-03-02 15:56:31
Message-ID: 200703021656.31415.Vincenzo.Romano@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all.

Under Linux I'm trying to communicate to an instance of the psql client
running in the background through a couple of named pipes.
I'd like to do something like this:

$ mkfifo /tmp/pg_ipipe /tmp/pg_opipe
$ psql -d testdb -U testuser < /tmp/pg_ipipe > /tmp/pg_opipe &
...
$ echo "\t" > /tmp/pg_ipipe
$ echo "select count(*) from test_table;" > /tmp/pg_ipipe
$ read COUNT < /tmp/pg_opipe

The psql client connects to the DB abd waits for the first commad coming from
the "pg_ipipe" and executes it. Fine.
The problem is that it quits soon after instead of waiting for the second (and
any subsequent) command, as we all see in the usual command line usage.
I've also tried to add a "--file -" with no luck.
It seems that when the psql is getting the input from a named pipe acts as if
the "--command" option were active.

I'm sure I'm missing something. But don't know what.
Is there any hint?

MTIA!

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-03-02 16:00:24 Re: supporting 2000 simultaneous connections.
Previous Message Richard Huxton 2007-03-02 15:38:38 Re: Differences in identical queries