avoid errors on failed insert because of duplicates
This commit is contained in:
parent
277e712449
commit
788e4f0324
1 changed files with 1 additions and 1 deletions
|
@ -269,7 +269,7 @@ class EventResource(BaseEvent):
|
|||
resp.status = falcon.HTTP_201
|
||||
|
||||
def on_post(self, req, resp):
|
||||
self.insert_or_update(req, resp, None, """INSERT INTO events ( events_type, events_what, events_when, events_tags, events_geo) VALUES (%s, %s, tstzrange(%s,%s,%s) , %s, %s) RETURNING events_id;""")
|
||||
self.insert_or_update(req, resp, None, """INSERT INTO events ( events_type, events_what, events_when, events_tags, events_geo) VALUES (%s, %s, tstzrange(%s,%s,%s) , %s, %s) ON CONFLICT DO NOTHING RETURNING events_id;""")
|
||||
|
||||
def on_put(self, req, resp, id):
|
||||
self.insert_or_update(req, resp, id, """UPDATE events SET ( events_type, events_what, events_when, events_tags, events_geo) = (%s, %s, tstzrange(%s,%s,%s) , %s, %s) WHERE events_id = %s RETURNING events_id;""")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue