Re: error handling

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Verena Ruff <lists(at)triosolutions(dot)at>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: error handling
Date: 2006-05-10 23:04:54
Message-ID: 44627196.5010201@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Verena Ruff wrote:
> Sean Davis schrieb:
>
>> Just keep in mind that the trigger runs on EVERY insert, even those for
>> which the unique clause is not violated. If that is the behavior you
>> need,
>> then use the trigger. However, if you know that after you have clean
>> data
>> in the table, you will not be inserting "duplicates" (I think this is the
>> typical case), then a trigger may not be the way to go.
>>
>
> These were my concerns in the first place I was thinking about using
> triggers. Maybe I haven't really understood your suggestion right. When
> would the temporary table be created? Isn't it neccessary to create it
> on every insert, too? With wich statement could I do this without using
> a trigger which is fired on every insert?
>
> Thanks for your patience.

No problem. I was thinking that you had a bunch of data that you wanted
to load ONCE, clean up, and then you would NOT be inserting duplicated
values. If you are going to be inserting duplicates potentially with
every insert, I think that a trigger is the only way to go on the DB
side of things. Of course, you could do things on the client side, as
well (do a lookup, find nothing--do insert, find something--do nothing
or do update).

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-05-11 00:01:42 Re: Vacuuming static tables.
Previous Message Terry Lee Tucker 2006-05-10 22:50:07 Re: difference between := and =