Re: COPY enhancements

Поиск
Список
Период
Сортировка
От Emmanuel Cecchet
Тема Re: COPY enhancements
Дата
Msg-id 4AAAD0C2.2060800@asterdata.com
обсуждение исходный текст
Ответ на Re: COPY enhancements  (Greg Smith <gsmith@gregsmith.com>)
Ответы Re: COPY enhancements  (Greg Smith <gsmith@gregsmith.com>)
Список pgsql-hackers
Greg Smith wrote:
> The full set of new behavior here I'd like to see allows adjusting:
>
> -Accept or reject rows with extra columns?
> -Accept or reject rows that are missing columns at the end?
> --Fill them with the default for the column (if available) or NULL?
> -Save rejected rows?
> --To a single system table?
> --To a user-defined table?
> --To the database logs?
The proposed patch save all rejected rows (with extra or missing 
columns) to a user-defined table (that can be created automatically). If 
you want to handle these bad rows on the fly, I guess you could have a 
trigger on the error table that does the appropriate processing 
depending on the data you are processing. In that case, having multiple 
error tables allows you to plug different triggers to handle possible 
error cases differently. The other option is to process the error table 
after COPY to handle the bad rows.
I guess the problem with extra or missing columns is to make sure that 
you know exactly which data belongs to which column so that you don't 
put data in the wrong columns which is likely to happen if this is fully 
automated.

I will try to re-read the thread on your proposal to better understand 
how you figure out which rows are missing or extra.

Emmanuel

-- 
Emmanuel Cecchet
Aster Data Systems
Web: http://www.asterdata.com



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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: COALESCE and NULLIF semantics
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: COPY enhancements