Skip to content

Conversation

@rfdrake
Copy link
Contributor

@rfdrake rfdrake commented Apr 8, 2015

With the normal order, updatedevices can end up filling the postgres logs with thousands of lines like this:

2014-01-09 22:20:14 EST ERROR:  duplicate key value violates unique constraint "ipblock1"
2014-01-09 22:20:14 EST DETAIL:  Key (address, prefix)=(184398081, 32) already exists.
2014-01-09 22:20:14 EST STATEMENT:  INSERT INTO ipblock
                                              (address,prefix,version,status,first_seen,last_seen)
                                               VALUES ($1, $2, $3, $4, $5, $6)

This fixes it so UPDATE is tried first, then INSERT if no rows were updated.

With the normal order, updatedevices can end up filling the postgres logs with thousands of lines like this:

    2014-01-09 22:20:14 EST ERROR:  duplicate key value violates unique constraint "ipblock1"
    2014-01-09 22:20:14 EST DETAIL:  Key (address, prefix)=(184398081, 32) already exists.
    2014-01-09 22:20:14 EST STATEMENT:  INSERT INTO ipblock
                                                  (address,prefix,version,status,first_seen,last_seen)
                                                   VALUES ($1, $2, $3, $4, $5, $6)

This fixes it so UPDATE is tried first, then INSERT if no rows were updated.
vink78 added a commit to vink78/Netdot that referenced this pull request Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant