From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | masyaf <kavtaradze(dot)s(at)gmail(dot)com> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: query option in COPY postgres |
Date: | 2015-11-06 22:02:33 |
Message-ID: | CAKFQuwYNmOMSCfy_nuTwhh3LReBuyJUyykLkHT7eyAYSmALwSQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, Nov 6, 2015 at 1:22 PM, masyaf <kavtaradze(dot)s(at)gmail(dot)com> 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 '*';
>
Directly? No. the entirity of the data being imported must exist within
the specified input file. If the file contains fewer columns than the
target table, or in a differing order, you can specify column names. Any
columns not specified will take on their default value. If the column is a
"serial" column is will get its default value from the corresponding
sequence.
> How to use exactly options in COPY command, it has {} | [] symbols in
> documentation.
>
{} - means required; choose one of the listed options
[] - mean options; choose on of the listed options (possibly only one)
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2015-11-06 22:40:52 | Re: query option in COPY postgres |
Previous Message | masyaf | 2015-11-06 20:22:36 | query option in COPY postgres |