Open
Description
While formatting code with pg_format facing issue when my query use EXCEPTION block for trigger. Can someone please help here? I'm missing anything here?
Code:
CREATE OR REPLACE FUNCTION trigger_before_insert_tg_name ()
RETURNS TRIGGER
AS $$
BEGIN
-- do some operation
-- Check if the resource_type is list of monitored resources
RETURN NEW;
EXCEPTION
-- Catch any errors that occur in the trigger
WHEN OTHERS THEN
-- Optionally log the error to another table or perform some action
RAISE WARNING 'Trigger failed: %', SQLERRM;
-- Continue without interrupting the original INSERT
RETURN NEW;
END;
Metadata
Metadata
Assignees
Labels
No labels