turing85 commented on PR #9286:
URL: https://github.com/apache/camel/pull/9286#issuecomment-1425713891

   @zhfeng An `upsert` based on `MERGE`  would look something like this (in 
`psql`, haven't checked whether this works in other databases):
   ```
   MERGE INTO CAMEL_MESSAGEPROCESSED AS saved
   USING (
     VALUES ('foo', 'bar', 'baz', CURRENT_TIMESTAMP)
   ) AS param (
     servicename,
     processorname,
     messageId,
     createdat
   )
   ON (
     saved.servicename = param.servicename AND
     saved.processorname = param.processorname AND
     saved.messageId = param.messageId)
   WHEN NOT MATCHED THEN
     INSERT (servicename, processorname, messageId, createdat)
     VALUES (param.servicename, param.processorname, param.messageId, 
param.createdat)
   WHEN MATCHED THEN
     UPDATE SET createdat = param.createdat, done = false;
   ```
   I am not sure if this is a good user experience; those queries are complex...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to