Error Trapping -duplicate keys

Поиск
Список
Период
Сортировка
От Steven D. Smith
Тема Error Trapping -duplicate keys
Дата
Msg-id OF2AFA5B96.70E5AF0C-ON85256BEA.003EF531@health.state.ny.us
обсуждение исходный текст
Ответы Re: Error Trapping -duplicate keys  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
Список pgsql-novice
Help:

I'm using Perl to insert data from a log file, what I am doing is this
(Pseudocode):

If NOT (INSERT INTO myTABLE)
THEN UPDATE myTABLE
endIf

Now the code I have works except I get a console message:

      DBD::Pg::st execute failed: ERROR:  Cannot insert a duplicate key
into unique index visitor_pkey at ./inslog.pl line 147, <> chunk 4.

So, my question is how to I trap this error, keep it from being display as
it is not really an error if the insert fails?


Many thanks!

S. Douglas Smith Sr.
-------------------------------------------------------------------------------------------------

"Simplicity is the most difficult thing to secure in this world; it is the
last limit of experience, and the last effort of genius." George Sand





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

Предыдущее
От: Pierre-Yves LANDURE
Дата:
Сообщение: Agregation Function
Следующее
От: Ludwig Lim
Дата:
Сообщение: Re: Error Trapping -duplicate keys