Re: pipe text to copy statement stdin input

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Scott Frankel <frankel(at)circlesfx(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pipe text to copy statement stdin input
Date: 2011-06-21 19:53:01
Message-ID: 45244DD0-349E-4CCF-A79D-1784745E3741@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jun 21, 2011, at 15:43, Scott Frankel wrote:

> Is there a way to pipe text into a COPY statement's stdin input using cmd-line psql?

cat myfile | psql -c "COPY mytable (name, description, text) FROM stdin"

> - The db is password protected, so invoking `psql` as a non-interactive command may not be possible. Right?

Use a .pgpass file

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-06-21 20:10:43 Re: pipe text to copy statement stdin input
Previous Message Vincent Veyron 2011-06-21 19:50:28 Re: Tuning for a tiny database