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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Sat, Sep 1, 2018 at 6:14 AM, pavan95 <pavan.postgresdba@xxxxxxxxx> 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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux