[GENERAL] pipe text to copy statement stdin input

2011-06-21 Thread Scott Frankel
Hi all, Is there a way to pipe text into a COPY statement's stdin input using cmd-line psql? I'm using the following syntax to enter large strings of text into a table. The text itself has a json-like syntax that has the potential for carrying numerous special characters.

Re: [GENERAL] pipe text to copy statement stdin input

2011-06-21 Thread John R Pierce
On 06/21/11 12:43 PM, Scott Frankel wrote: Hi all, Is there a way to pipe text into a COPY statement's stdin input using cmd-line psql? I'm using the following syntax to enter large strings of text into a table. The text itself has a json-like syntax that has the potential for carrying

Re: [GENERAL] pipe text to copy statement stdin input

2011-06-21 Thread Michael Glaesemann
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

Re: [GENERAL] pipe text to copy statement stdin input

2011-06-21 Thread Scott Frankel
John, Michael, Thanks for the thorough tips. Worked perfectly! The .pgpass file is quite useful. Could've saved myself a lot of typing the past few years! Note that since I already prepared a CSV formated file for the COPY statement, once I created the .pgpass file, I opted for