pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: Can we exclude errors of some particular text in Postgres log file?
4+ messages / 3 participants
[nested] [flat]

* Re: Can we exclude errors of some particular text in Postgres log file?
@ 2018-09-01 10:14  pavan95 <pavan.postgresdba@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: pavan95 @ 2018-09-01 10:14 UTC (permalink / raw)
  To: pgsql-admin

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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Can we exclude errors of some particular text in Postgres log file?
@ 2018-09-01 15:57  Keith <keith@keithf4.com>
  parent: pavan95 <pavan.postgresdba@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Keith @ 2018-09-01 15:57 UTC (permalink / raw)
  To: pavan95 <pavan.postgresdba@gmail.com>; +Cc: 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.

https://www.postgresql.org/docs/current/static/sql-insert.html

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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Can we exclude errors of some particular text in Postgres log file?
@ 2018-09-01 16:01  David G. Johnston <david.g.johnston@gmail.com>
  parent: pavan95 <pavan.postgresdba@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2018-09-01 16:01 UTC (permalink / raw)
  To: pavan95 <pavan.postgresdba@gmail.com>; +Cc: pgsql-admin

On Saturday, September 1, 2018, pavan95 <pavan.postgresdba@gmail.com> wrote:

> Hi Team,
>
> Can we exclude errors of a particular type from the postgres log file ?
>

No, it is not possible to apply textual filtering during log generation.

David J.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Can we exclude errors of some particular text in Postgres log file?
@ 2018-09-03 05:27  pavan95 <pavan.postgresdba@gmail.com>
  parent: Keith <keith@keithf4.com>
  0 siblings, 0 replies; 4+ messages in thread

From: pavan95 @ 2018-09-03 05:27 UTC (permalink / raw)
  To: pgsql-admin

Hi Keith,

I'm getting this error due to logical replication configured. And this error
is occurring on the Subscriber Side.

In my point of view, Logical Replication worker process is continuously
checking and trying to insert each row right from the start even if that
particular row has been already present in the table. And that's the reason
of this continuous occurring of the error.

One small doubt is if a table A has 10 records(which were inserted on the
publisher) and all the 10 records were replicated to the subscriber. Now
when I insert the 11'th record will it replicate only the last record or try
to replicate(or check if all rows have been replicated) all the rows of the
table A right from the first?? Please confirm..

If it does the latter(try to replicate all rows) then the above error will
arise as table A has replica identity(Primary key).

>>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.

Could you please provide me an example of accomplishing it!!

Thanks in Advance.

Regards,
Pavan



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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2018-09-03 05:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-01 10:14 Re: Can we exclude errors of some particular text in Postgres log file? pavan95 <pavan.postgresdba@gmail.com>
2018-09-01 15:57 ` Keith <keith@keithf4.com>
2018-09-03 05:27   ` pavan95 <pavan.postgresdba@gmail.com>
2018-09-01 16:01 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox