search for: insert_to_upd

Displaying 1 result from an estimated 1 matches for "insert_to_upd".

2020 Apr 23
0
Re-to-archived-thread: Dict issue with PostgreSQL for last_login plugin (duplicate key)
...ons on how to set up a last_login on the official documentation. Therefor I creates a very simple table having userid and last_login fields. Added plugin and dict information. I received the duplicate key errors and I did this trick for now, which seems to solve this issue: CREATE OR REPLACE RULE insert_to_update AS ON INSERT TO users WHERE EXISTS (SELECT userid FROM users WHERE userid = NEW.userid) DO INSTEAD UPDATE users SET last_login = NEW.last_login WHERE userid = NEW.userid With this rule in place, INSERTs are changed to UPDATEs, if a userid entry already exists. No...