Trigger Functions
- pg_get_triggerdef(oid)
Description: Obtains the definition information of a trigger.
Parameter: OID of the trigger to be queried
Return type: text
Example:
openGauss=# select pg_get_triggerdef(oid) from pg_trigger; pg_get_triggerdef -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- CREATE TRIGGER tg1 BEFORE INSERT ON gtest26 FOR EACH STATEMENT EXECUTE PROCEDURE gtest_trigger_func() CREATE TRIGGER tg03 AFTER INSERT ON gtest26 FOR EACH ROW WHEN ((new.a IS NOT NULL)) EXECUTE PROCEDURE gtest_trigger_func() (2 rows)
- pg_get_triggerdef(oid, boolean)
Description: Obtains the definition information of a trigger.
Parameter: OID of the trigger to be queried and whether it is displayed in pretty mode
Boolean parameters take effect only when the WHEN condition is specified during trigger creation.
Return type: text
Example:
openGauss=# select pg_get_triggerdef(oid,true) from pg_trigger; pg_get_triggerdef -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- CREATE TRIGGER tg1 BEFORE INSERT ON gtest26 FOR EACH STATEMENT EXECUTE PROCEDURE gtest_trigger_func() CREATE TRIGGER tg03 AFTER INSERT ON gtest26 FOR EACH ROW WHEN (new.a IS NOT NULL) EXECUTE PROCEDURE gtest_trigger_func() (2 rows) openGauss=# select pg_get_triggerdef(oid,false) from pg_trigger; pg_get_triggerdef -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- CREATE TRIGGER tg1 BEFORE INSERT ON gtest26 FOR EACH STATEMENT EXECUTE PROCEDURE gtest_trigger_func() CREATE TRIGGER tg03 AFTER INSERT ON gtest26 FOR EACH ROW WHEN ((new.a IS NOT NULL)) EXECUTE PROCEDURE gtest_trigger_func() (2 rows)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot