Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

31.37. triggers

The view triggers contains all triggers defined in the current database that are owned by the current user. (The owner of the table is the owner of the trigger.)

Table 31-35. triggers Columns

Name Data Type Description
trigger_catalog sql_identifier Name of the database that contains the trigger (always the current database)
trigger_schema sql_identifier Name of the schema that contains the trigger
trigger_name sql_identifier Name of the trigger
event_manipulation character_data Event that fires the trigger (INSERT, UPDATE, or DELETE)
event_object_catalog sql_identifier Name of the database that contains the table that the trigger is defined on (always the current database)
event_object_schema sql_identifier Name of the schema that contains the table that the trigger is defined on
event_object_table sql_identifier Name of the table that the trigger is defined on
action_order cardinal_number Not yet implemented
action_condition character_data Applies to a feature not available in PostgreSQL
action_statement character_data Statement that is executed by the trigger (currently always EXECUTE PROCEDURE function (...))
action_orientation character_data Identifies whether the trigger fires once for each processed row or once for each statement (ROW or STATEMENT)
condition_timing character_data Time at which the trigger fires (BEFORE or AFTER)
condition_reference_old_table sql_identifier Applies to a feature not available in PostgreSQL
condition_reference_new_table sql_identifier Applies to a feature not available in PostgreSQL

Triggers in PostgreSQL have two incompatibilities with the SQL standard that affect the representation in the information schema. First, trigger names are local to the table in PostgreSQL, rather than being independent schema objects. Therefore there may be duplicate trigger names defined in one schema, as long as they belong to different tables. (trigger_catalog and trigger_schema are really the values pertaining to the table that the trigger is defined on.) Second, triggers can be defined to fire on multiple events in PostgreSQL (e.g., ON INSERT OR UPDATE), whereas the SQL standard only allows one. If a trigger is defined to fire on multiple events, it is represented as multiple rows in the information schema, one for each type of event. As a consequence of these two issues, the primary key of the view triggers is really (trigger_catalog, trigger_schema, trigger_name, event_object_table, event_manipulation) instead of (trigger_catalog, trigger_schema, trigger_name), which is what the SQL standard specifies. Nonetheless, if you define your triggers in a manner that conforms with the SQL standard (trigger names unique in the schema and only one event type per trigger), this will not affect you.


 
 
  Published courtesy of The PostgreSQL Global Development Group Design by Interspire