Skip to content

ProgrammingError: (psycopg.errors.CardinalityViolation) ON CONFLICT DO UPDATE command cannot affect row a second time

Sentry Issue: WAVEQC-J

CardinalityViolation: ON CONFLICT DO UPDATE command cannot affect row a second time
HINT:  Ensure that no rows proposed for insertion within the same command have duplicate constrained values.
  File "sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    self.dialect.do_execute(
  File "sqlalchemy/engine/default.py", line 922, in do_execute
    cursor.execute(statement, parameters)
  File "psycopg/cursor.py", line 737, in execute
    raise ex.with_traceback(None)

ProgrammingError: (psycopg.errors.CardinalityViolation) ON CONFLICT DO UPDATE command cannot affect row a second time
HINT:  Ensure that no rows proposed for insertion within the same command have duplicate constrained values.
[SQL: INSERT INTO channel (code, location, latitude, longitude, elevation, depth, station_id) VALUES (%(code_m0)s::VARCHAR, %(location_m0)s::VARCHAR, %(latitude_m0)s, %(longitude_m0)s, %(elevation_m0)s, %(depth_m0)s, %(station_id_m0)s::INTEGER), (%(code_m1)s::VARCHAR, %(location_m1)s::VARCHAR, %(latitude_m1)s, %(longitude_m1)s, %(elevation_m1)s, %(depth_m1)s, %(station_id_m1)s::INTEGER), (%(code_m2)s::VARCHAR, %(location_m2)s::VARCHAR, %(latitude_m2)s, %(longitude_m2)s, %(elevation_m2)s, %(depth_m2)s, %(station_id_m2)s::INTEGER), (%(code_m3)s::VARCHAR, %(location_m3)s::VARCHAR, %(latitude_m3)s, %(longitude_m3)s, %(elevation_m3)s, %(depth_m3)s, %(station_id_m3)s::INTEGER), (%(code_m4)s::VARCHAR, %(location_m4)s::VARCHAR, %(latitude_m4)s, %(longitude_m4)s, %(elevation_m4)s, %(depth_m4)s, %(station_id_m4...
(11 additional frame(s) were not displayed)
...
  File "waveqc/tasks.py", line 98, in update_inventory
    network.populate_channels(self.dbsession, inventory_network, stations)
  File "waveqc/models.py", line 168, in populate_channels
    result = dbsession.scalars(
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information