I need to create a data patching script and I'd like to rollback the transaction when some condition occurs.
I could do something like this in the end of the script:
select t.id / 0
from some_table t
where t.state = 'undersirable state'
but I'd rather have a more appropriate error message than "division by zero".
Is there a generic function for generating errors in PostgreSQL? I'd like to do it without PL/SQL, if possible.
DOblock.CASEexpression used within aSELECTorUPDATE.