Elliot B.
Elliot B.

Reputation: 17661

PostgreSQL exceptions with failed inserts

Is there any circumstance where an exception will not be thrown if an insert statement in a stored procedure fails?

I'm using catch-all style exception handling in my PostgreSQL stored procedures via EXCEPTION WHEN OTHERS THEN. I'm wondering if that's sufficient to catch all failed inserts.

Upvotes: 1

Views: 10278

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656616

That should cover it.
I quote the manual on Trapping Errors in PL/pgSQL:

The special condition name OTHERS matches every error type except QUERY_CANCELED. (It is possible, but often unwise, to trap QUERY_CANCELED by name.)

Upvotes: 3

Related Questions