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-06 22:40:52
Message-ID: 563D2C74.8050408@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 11/06/2015 12:22 PM, masyaf wrote:
> According to COPY documentation , I can use query option when exporting data.
> Can I use query VALUES when loading data into tables from txt file? If I
> have 2 columns and I want to insert record manually in the first
> column(SentenceID) and insert data in the second column(Sentence) from text
> file. Is it something like:
>
> copy foo1(Sentence) | (VALUES (2339)) from '/path/to/sentence.txt' with
> delimiter '*';

In addition to what David posted, in Postgres 9.3+ you have option of
doing COPY FROM a program instead of a file. This opens the possibility
of using an external program to get your data into the form and order
you need and then have COPY pull from that.
>
> How to use exactly options in COPY command, it has {} | [] symbols in
> documentation.
>
>
>
> --
> View this message in context: http://postgresql.nabble.com/query-option-in-COPY-postgres-tp5873015.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message masyaf 2015-11-06 22:54:46 Re: query option in COPY postgres
Previous Message David G. Johnston 2015-11-06 22:02:33 Re: query option in COPY postgres