Re: Can COPY skip columns?

Поиск
Список
Период
Сортировка
От Ian Harding
Тема Re: Can COPY skip columns?
Дата
Msg-id s19dcf5e.084@MAIL.TPCHD.ORG
обсуждение исходный текст
Ответ на Can COPY skip columns?  (Adam Witney <awitney@sghms.ac.uk>)
Список pgsql-general
Since we can specify the order of columns in copy, how hard would it be
(he asked, naively) to specify a column name that points to /dev/null
(or the postgresql internals equivalent)?  Sybase's copy utility is very
similar to our copy, and has a function that you can specify in your
column list instead of a real column name that ignores the data.

Something like

copy mytable (col1, col2, ignore(), col3) from '/tmp/dump';

Not a big deal, but kind of handy.

Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding@tpchd.org
Phone: (253) 798-3549
Pager: (253) 754-0002

>>> Tom Lane <tgl@sss.pgh.pa.us> 11/18/04 9:15 AM >>>
Adam Witney <awitney@sghms.ac.uk> writes:
> Is it possible for the COPY command to read data from a file, but skip
> specific columns?

Nope.  When you get into significant massaging of the input data,
usually the best bet is to COPY into a temp table that exactly matches
the format of the data file, and then do your rearrangements using an
INSERT/SELECT into the final target table.

            regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
      joining column's datatypes do not match


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

Предыдущее
От: Pierre-Frédéric Caillaud
Дата:
Сообщение: Re: Can COPY skip a header line?
Следующее
От: Chris Green
Дата:
Сообщение: phpPgAdmin problem - this list?