Re: COPY Transform support

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: COPY Transform support
Дата
Msg-id 200804072136.43679.dfontaine@hi-media.com
обсуждение исходный текст
Ответ на Re: COPY Transform support  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: COPY Transform support  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Le Monday 07 April 2008 21:04:26 Andrew Dunstan, vous avez écrit :
> Quite apart from any other reason why not, this would be a horrid hack
> and is just the sort of "feature" we rightly eschew, IMNSHO. COPY is
> designed as a bulk load/unload facility. It's fragile enough in that role.

And my main concern would still be left as-is, COPY wouldn't have any facility
to cope with data representation not matching what datatype input functions
want to read. More often than not, you get this kind of data from another
system, so in a deterministic way, and you want a chance to transform their
representation just before PostgreSQL parses it.

May I try to insist on my second syntax proposal form:

  COPY destination_table(col1, col2, col3)
 USING (field1, field2 || field3, myfunc(field4, field5))
  FROM 'file.txt'
  WITH ...

This allows for the case I'm concerned with to be taken care of, AND the other
case pointed out by several posters on this thread too. N input fields, M
stored columns, any line to row transformation (after same column splitting
as of now), any column pre-parsing through SQL callable functions --- myfunc
is called before feeding col3%ROWTYPE input function, e.g.
And no support (that I see) for optional second storage system back door.

Comments?
--
dim

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: File system snapshots for multiple file systems
Следующее
От: Zoltan Boszormenyi
Дата:
Сообщение: Re: TRUNCATE TABLE with IDENTITY