allow COPY routines to read arbitrary numbers of fields

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема allow COPY routines to read arbitrary numbers of fields
Дата
Msg-id 4CFBD15B.8010000@dunslane.net
обсуждение исходный текст
Ответы Re: allow COPY routines to read arbitrary numbers of fields  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Attached is a patch that allows CopyReadAttibutesText() and
CopyReadAttributesCSV() to read arbitrary numbers of attributes.
Underflowing attributes are recorded as null, and space is made for
overflowing attributes on a line.

This patch doesn't result in any user-visible behavior. The current
calling code will fail if the number of attributes read is not what is
expected, as happens now. But it will allow the API to be used (when
exposed) by a foreign data wrapper that can accept arbitrary numbers of
attributes. My aim here is to get to something like:

    CREATE FOREIGN TABLE my_csv (
         t text[]
    )
    SERVER file_server
    OPTIONS (format 'csv', filename '/path/to/my/data.csv', textarray
    'true',
              header 'true', delimiter ';', quote '@', escape '"', null '');

    SELECT t[3] as f1, t[1] as f2, t[9999] as probably_null
    FROM my_csv;

It would probably be nice to apply this before we start exposing the
COPY API to FDW routines, as discussed earlier today.

cheers

andrew




Вложения

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: FK's to refer to rows in inheritance child
Следующее
От: Greg Smith
Дата:
Сообщение: Re: WIP patch for parallel pg_dump