Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5881

Duplicate key violates unique constraint error in PostgreSQL

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 2.0.2
    • Server (S)
    • CentOS 6.2 64bit

      PostgreSQL 8.4.9

      I am seeing errors from time to time in PostgreSQL's logs about a table called events. The events table is used to stores information generated by triggers in Zabbix everytime a specific event occurs on a server that is being monitored.

      Zabbix is the only application using the database server.

      Here is the error

      INSTRUCTION : insert into events (eventid,source,object,objectid,clock,ns,value,value_changed) values (6393428,2,3,38,1353354000,0,1,0)
      ERROR: duplicate key violates unique constraint « events_pkey »

      Question

      What steps can I take to resolve this error?

      On dba.stackexchange.com, I have been told to add a sequence to Events, what effect would that have?

      Code:
      ALTER TABLE events ALTER COLUMN eventid TYPE bigserial;

      http://dba.stackexchange.com/posts/29043/edit

            Unassigned Unassigned
            c.efrein Craig Efrein
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: