From: | "Ian Harding" <ianh(at)tpchd(dot)org> |
---|---|
To: | <annachau(at)hongkong(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Can I User @@error of MS SQL in postgresql |
Date: | 2002-12-06 14:52:14 |
Message-ID: | sdf0496a.083@mail.tpchd.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
PostgreSQL is much more strict about error handling. MSSQLServer will continue merrily along without interrupting the procedure or affecting the in-progress transaction if errors occur. It is up to you to catch them and decide how to handle them. PGSQL will ignore all further queries and roll back the transaction automatically if any errors are returned from a query. In other words, you don't have to worry about it. If there are cases where the action failing would be OK, you need to test for those cases (i.e. duplicate key already exists) before the action. Keep in mind that those checks will not always be valid given the status of other transactions and your isolation level.
Isn't this fun?
Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding(at)tpchd(dot)org
(253) 798-3549
>>> "annachau" <annachau(at)hongkong(dot)com> 12/05/02 11:13PM >>>
I have a plpgsql function to insert a record into a table. In MS SQL, I can user @@error to check the insert action is completed or not. What can I do in postgresql?
Thanks a lot.
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Burton | 2002-12-06 15:00:37 | Re: Can I User @@error of MS SQL in postgresql |
Previous Message | Dave Page | 2002-12-06 14:09:20 | Re: [GENERAL] Drop column and Access |