Re: error handling

From: Verena Ruff <lists(at)triosolutions(dot)at>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: error handling
Date: 2006-05-10 12:51:13
Message-ID: 4461E1C1.7090902@triosolutions.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

Sean Davis schrieb:

>> If you are copying bulk data into the table only once, then cleaning the
>> data up front will not impact your actual use down the road. If you are
>> saying that you will be inserting non-unique values and need to catch that,
>> a trigger is the better way to go.
This is what I need to do.
>> As for testing if the value is existing
>> or not, you can avoid that by using SQL functions (like the postgresql
>> specific distinct on) to select from the temporary table only those values
>> that are unique. See here in the docs:
>>
>> http://www.postgresql.org/docs/8.1/interactive/sql-select.html#SQL-DISTINCT
>>
OK, I forgot about DISTINCT.
> I should have pointed out that the solution depends on your needs. If you
> don't see an advantage, it is likely because there isn't one for your
> particular needs, so feel free to use some other option
Thanks for your hints. In my situation (many inserts and only a few
would break the unique clause) I think using a trigger is the way to get
a better performance.

Regards,
Verena

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Verena Ruff 2006-05-10 13:04:20 index not used with inherited tables
Previous Message Bruce Momjian 2006-05-10 01:00:54 Re: No quoting in copy CSV mode