| От | Tom Lane |
|---|---|
| Тема | Re: copy files to postgresql |
| Дата | |
| Msg-id | 15114.1028642467@sss.pgh.pa.us обсуждение |
| Ответ на | Re: copy files to postgresql (Jeff Eckermann <jeff_eckermann@yahoo.com>) |
| Список | pgsql-sql |
Jeff Eckermann <jeff_eckermann@yahoo.com> writes:
> I believe that soon-to-be-released version 7.3 will
> have the ability to import data to specific columns,
> as you are trying to do. For now, you will have to
> edit your input file to insert values (even if null)
> for the missing columns.
A usually-easier way is to make a temp table that matches the column
format of the source file, COPY into that, and then doINSERT INTO finaltable SELECT foo,bar,... FROM temptable
In the INSERT/SELECT it's trivial to do any rearrangement you want.
7.3 will add some more flexibility to COPY, but it only saves a
step, doesn't really do anything you can't do with a temp table.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера