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

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Server (S)
    • Labels:
    • Environment:
      CentOS 6.2 64bit

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: