Re: query option in COPY postgres

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: masyaf <kavtaradze(dot)s(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: query option in COPY postgres
Date: 2015-11-09 17:13:40
Message-ID: 5640D444.30801@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 11/06/2015 02:54 PM, masyaf wrote:
> Can you give any details about that?
>

I am assuming you are referring to COPY FROM a program.

Take a look at the docs:

http://www.postgresql.org/docs/9.4/interactive/sql-copy.html

"When PROGRAM is specified, the server executes the given command and
reads from the standard output of the program, or writes to the standard
input of the program. The command must be specified from the viewpoint
of the server, and be executable by the PostgreSQL user. When STDIN or
STDOUT is specified, data is transmitted via the connection between the
client and the server."

In my case I would write the program in Python and output CSV. Every
time I do that though, I just go ahead and use the copy_from() method of
the psycopg2 cursor and never get to the above.

>
>
> --
> View this message in context: http://postgresql.nabble.com/query-option-in-COPY-postgres-tp5873015p5873038.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message ranjitsaurav 2015-11-12 07:35:54 Exception Handling in Postgis function
Previous Message masyaf 2015-11-06 22:54:46 Re: query option in COPY postgres