Re: Practical error logging for very large COPY

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Practical error logging for very large COPY
Дата
Msg-id 20051122153348.GD12548@svana.org
обсуждение исходный текст
Ответ на Re: Practical error logging for very large COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Practical error logging for very large COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Practical error logging for very large COPY  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-hackers
On Tue, Nov 22, 2005 at 09:58:44AM -0500, Tom Lane wrote:
> The general problem that needs to be solved is "trap any error that
> occurs during attempted insertion of a COPY row, and instead of aborting
> the copy, record the data and the error message someplace else".  Seen
> in that light, implementing a special path for uniqueness violations is
> pretty pointless.

Actually, there are really only a few errors people want to trap I
imagine:

- CHECK constraints (all handled in ExecConstraints)
- Duplicate keys
- Foreign key violations (all handled by triggers)

Rather than worry about all the events we can't safely trap, how about
we simply deal with the handful that are trappable. For example, we let
people create an ON ERROR trigger and use the existing trigger
interface. We have three possibilities:

- They return the same tuple, throw the error
- They return NULL, ignore error, goto next tuple
- They return a different tuple, retest the conditions

The trigger can then do anything a normal trigger can do, including
copying to another table if people like that.

This doesn't seem like awfully hard work, does it? Initially at least,
no TRY blocks needed...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Grzegorz Jaskiewicz
Дата:
Сообщение: Re: order by, for custom types
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: order by, for custom types