Re: Can we exclude errors of some particular text in Postgres log file?

Поиск
Список
Период
Сортировка
От Keith
Тема Re: Can we exclude errors of some particular text in Postgres log file?
Дата
Msg-id CAHw75vsYG8XM=Peg0Pz17dacDKgdSRhPq0p0kyy8bpGuHNzeTg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Can we exclude errors of some particular text in Postgres logfile?  (pavan95 <pavan.postgresdba@gmail.com>)
Ответы Re: Can we exclude errors of some particular text in Postgres logfile?  (pavan95 <pavan.postgresdba@gmail.com>)
Список pgsql-admin


On Sat, Sep 1, 2018 at 6:14 AM, pavan95 <pavan.postgresdba@gmail.com> wrote:
Hi Team,

Can we exclude errors of a particular type from the postgres log file ?

For example:
ERROR:  duplicate key value violates unique constraint "table_uniq"
DETAIL:  Key (column1, column2, column3)=(value0, value1, 1) already exists.

If yes, how can we exclude this errors from the pg_log files. Suggest me an
approach.

Thanks in Advance.

Regards,
Pavan





--
Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html



I suggest upgrading to at least PostgreSQL 9.5 if you haven't already and look into the INSERT...ON CONFLICT feature (also called UPSERT). With it you can define what happens if an insert would violate a defined constraint and instead update the given row, do nothing or a wide variety of other operations.


If this doesn't fit the model that is causing your duplicate key errors, you may want to look into using a function to do your writes instead and catch the given error in an exception block and then just ignore it.

Keith

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump and disk full
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Can we exclude errors of some particular text in Postgres log file?