ome / omero-py

Python project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
22 stars 32 forks source link

Modify `omero db password` to use an upsert #202

Open joshmoore opened 4 years ago

joshmoore commented 4 years ago

See:

9.5 and newer:

PostgreSQL 9.5 and newer support INSERT ... ON CONFLICT UPDATE (and ON CONFLICT DO NOTHING), i.e. upsert.

https://stackoverflow.com/a/17267423

update password set hash = ... should become:

INSERT INTO password (experimenter_id, hash, changed) VALUES
(ID, 'Y', clock_timestamp()) ON CONFLICT (experimenter_id) DO
UPDATE SET hash = 'Y', changed = clock_timestamp();