agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: masyaf <kavtaradze.s@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: query option in COPY postgres
Date: Fri, 6 Nov 2015 14:40:52 -0800
Message-ID: <563D2C74.8050408@aklaver.com> (raw)
In-Reply-To: <1446841356122-5873015.post@n5.nabble.com>
References: <1446841356122-5873015.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)  latest in thread

Message-ID: <563D2C74.8050408@aklaver.com>
Permalink:  ../563D2C74.8050408@aklaver.com/
Also on:    postgresql.org/message-id/563D2C74.8050408@aklaver.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: adrian.klaver@aklaver.com, kavtaradze.s@gmail.com
  Subject: Re: query option in COPY postgres
  In-Reply-To: <563D2C74.8050408@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox