Re: query option in COPY postgres

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: query option in COPY postgres
Дата
Msg-id CAKFQuwYNmOMSCfy_nuTwhh3LReBuyJUyykLkHT7eyAYSmALwSQ@mail.gmail.com
обсуждение исходный текст
Ответ на query option in COPY postgres  (masyaf <kavtaradze.s@gmail.com>)
Список pgsql-sql
On Fri, Nov 6, 2015 at 1:22 PM, masyaf <kavtaradze.s@gmail.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.​

В списке pgsql-sql по дате отправления:

Предыдущее
От: masyaf
Дата:
Сообщение: query option in COPY postgres
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: query option in COPY postgres