AFTER INSERT trigger INSERT into another table-B are ignoring Table-B constraints

From: M Sarwar <sarwarmd02(at)outlook(dot)com>
To: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: AFTER INSERT trigger INSERT into another table-B are ignoring Table-B constraints
Date: 2024-05-22 21:14:46
Message-ID: DM4PR19MB59782D0B16534B7A56FB90B8D3EB2@DM4PR19MB5978.namprd19.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


Hello All,

This is a trigger related question.

Table, test_part_details_all_mcm_init has a trigger, tr_test_part_details_all_mcm_init.

CREATE TRIGGER tr_test_part_details_all_mcm_init

AFTER INSERT

ON bx.test_part_details_all_mcm_init

FOR EACH ROW

EXECUTE FUNCTION bx.tr_fn_test_part_details_all_mcm_init();

Function, bx.tr_fn_test_part_details_all_mcm_init() INSERTs a row into another table, bx.test_part_details_all_mcm_mid

Table, bx.test_part_details_all_mcm_mid has a constraint,

CONSTRAINT cons_unique_for_concatenated_view UNIQUE (start_time_numeric, stop_time_numeric, test_action, part_type, fixture_id, run_id, auxid1_build_id, auxid2_asic_id, serial_number, part_pf)

When I INSERT a data into the table Table, test_part_details_all_mcm_init , trigger is not checking CONSTRAINT cons_unique_for_concatenated_view while INSERTing the data in bx.test_part_details_all_mcm_mid. I am expecting that anything violating the constraint cons_unique_for_concatenated_view will throw an error. Instead of that it is allowing to INSERT the data.

What is that I am missing here?

Thanks,

Sarwar

Browse pgsql-admin by date

  From Date Subject
Next Message wolters.k 2024-05-22 22:38:41 Re: AFTER INSERT trigger INSERT into another table-B are ignoring Table-B constraints
Previous Message M Sarwar 2024-05-22 18:40:09 Re: Need guidance on partioning