system.db.runSFUpdateQuery ,Duplicate keys violate unique of database, always return True?

In Postgres Database, I set a unique of table.

But when I do it in Script, it always return True?

I think it's right to return False not True?

Why are you using SF?

The Store and Forward system cannot report the final result from the database, because it doesn't (cannot) wait for that to return. The "True" means the request was successfully queued in the S&F system.

If you need to handle actual database errors, you cannot use S&F.

Consider using an ON CONFLICT clause in your SQL to pre-emptively handle ID clashes. Then you can use S&F without generating quarantined elements.

1 Like


I use this script "system.db.runPrepUpdate"
I can see the log is error in print log.
But How can I judgment this error in id?

postgresql ON CONFLICT

INSERT INTO public.pc(processname, pno, productname)
VALUES ('PP','2024112701','产品3')
ON CONFLICT (processname,pno,productname)
DO NOTHING;

If success return id=1,else return id=0;
I think it's right.
Thank you very much!

1 Like