Vamsi Patchipulusu <vpatchipulusu@equinix.com> writes:
> Error: psql.bin: could not connect to server: Cannot assign requested address
> Is the server running on host "abchost.corp.xyz.com" (xxx.xxx.xxx.xxx) and accepting
> TCP/IP connections on port 5432?
Googling suggests that this could occur if you're recycling client-side
connections so fast that the old port number assignments haven't timed out
yet. That's not a Postgres bug, it's inherent in the TCP protocol specs.
> The shell script does the following:
> a) Connects to postgres database server using psql.
> b) Issues a single select statement on table with 200 rows .
> c) Writes the results to a text file.
There is a large body of evidence to the effect that issuing only one
query per connection attempt is a performance-killer. Don't do that, at
least not more often than you have to. This particular symptom is a new
one on me, but there are lots of other reasons not to do it.
regards, tom lane