gooderp18绿色标准版
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

74 lines
9.6KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>36.56. triggers</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="infoschema-triggered-update-columns.html" title="36.55. triggered_update_columns" /><link rel="next" href="infoschema-udt-privileges.html" title="36.57. udt_privileges" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">36.56. <code xmlns="http://www.w3.org/1999/xhtml" class="literal">triggers</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="infoschema-triggered-update-columns.html" title="36.55. triggered_update_columns">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="information-schema.html" title="Chapter 36. The Information Schema">Up</a></td><th width="60%" align="center">Chapter 36. The Information Schema</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="infoschema-udt-privileges.html" title="36.57. udt_privileges">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="INFOSCHEMA-TRIGGERS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">36.56. <code class="literal">triggers</code></h2></div></div></div><p>
  3. The view <code class="literal">triggers</code> contains all triggers defined
  4. in the current database on tables and views that the current user owns
  5. or has some privilege other than <code class="literal">SELECT</code> on.
  6. </p><div class="table" id="id-1.7.6.60.3"><p class="title"><strong>Table 36.54. <code class="literal">triggers</code> Columns</strong></p><div class="table-contents"><table class="table" summary="triggers Columns" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Data Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">trigger_catalog</code></td><td><code class="type">sql_identifier</code></td><td>Name of the database that contains the trigger (always the current database)</td></tr><tr><td><code class="literal">trigger_schema</code></td><td><code class="type">sql_identifier</code></td><td>Name of the schema that contains the trigger</td></tr><tr><td><code class="literal">trigger_name</code></td><td><code class="type">sql_identifier</code></td><td>Name of the trigger</td></tr><tr><td><code class="literal">event_manipulation</code></td><td><code class="type">character_data</code></td><td>
  7. Event that fires the trigger (<code class="literal">INSERT</code>,
  8. <code class="literal">UPDATE</code>, or <code class="literal">DELETE</code>)
  9. </td></tr><tr><td><code class="literal">event_object_catalog</code></td><td><code class="type">sql_identifier</code></td><td>
  10. Name of the database that contains the table that the trigger
  11. is defined on (always the current database)
  12. </td></tr><tr><td><code class="literal">event_object_schema</code></td><td><code class="type">sql_identifier</code></td><td>Name of the schema that contains the table that the trigger is defined on</td></tr><tr><td><code class="literal">event_object_table</code></td><td><code class="type">sql_identifier</code></td><td>Name of the table that the trigger is defined on</td></tr><tr><td><code class="literal">action_order</code></td><td><code class="type">cardinal_number</code></td><td>
  13. Firing order among triggers on the same table having the same
  14. <code class="literal">event_manipulation</code>,
  15. <code class="literal">action_timing</code>, and
  16. <code class="literal">action_orientation</code>. In
  17. <span class="productname">PostgreSQL</span>, triggers are fired in name
  18. order, so this column reflects that.
  19. </td></tr><tr><td><code class="literal">action_condition</code></td><td><code class="type">character_data</code></td><td>
  20. <code class="literal">WHEN</code> condition of the trigger, null if none
  21. (also null if the table is not owned by a currently enabled
  22. role)
  23. </td></tr><tr><td><code class="literal">action_statement</code></td><td><code class="type">character_data</code></td><td>
  24. Statement that is executed by the trigger (currently always
  25. <code class="literal">EXECUTE FUNCTION
  26. <em class="replaceable"><code>function</code></em>(...)</code>)
  27. </td></tr><tr><td><code class="literal">action_orientation</code></td><td><code class="type">character_data</code></td><td>
  28. Identifies whether the trigger fires once for each processed
  29. row or once for each statement (<code class="literal">ROW</code> or
  30. <code class="literal">STATEMENT</code>)
  31. </td></tr><tr><td><code class="literal">action_timing</code></td><td><code class="type">character_data</code></td><td>
  32. Time at which the trigger fires (<code class="literal">BEFORE</code>,
  33. <code class="literal">AFTER</code>, or <code class="literal">INSTEAD OF</code>)
  34. </td></tr><tr><td><code class="literal">action_reference_old_table</code></td><td><code class="type">sql_identifier</code></td><td>Name of the <span class="quote">“<span class="quote">old</span>”</span> transition table, or null if none</td></tr><tr><td><code class="literal">action_reference_new_table</code></td><td><code class="type">sql_identifier</code></td><td>Name of the <span class="quote">“<span class="quote">new</span>”</span> transition table, or null if none</td></tr><tr><td><code class="literal">action_reference_old_row</code></td><td><code class="type">sql_identifier</code></td><td>Applies to a feature not available in <span class="productname">PostgreSQL</span></td></tr><tr><td><code class="literal">action_reference_new_row</code></td><td><code class="type">sql_identifier</code></td><td>Applies to a feature not available in <span class="productname">PostgreSQL</span></td></tr><tr><td><code class="literal">created</code></td><td><code class="type">time_stamp</code></td><td>Applies to a feature not available in <span class="productname">PostgreSQL</span></td></tr></tbody></table></div></div><br class="table-break" /><p>
  35. Triggers in <span class="productname">PostgreSQL</span> have two
  36. incompatibilities with the SQL standard that affect the
  37. representation in the information schema. First, trigger names are
  38. local to each table in <span class="productname">PostgreSQL</span>, rather
  39. than being independent schema objects. Therefore there can be duplicate
  40. trigger names defined in one schema, so long as they belong to
  41. different tables. (<code class="literal">trigger_catalog</code> and
  42. <code class="literal">trigger_schema</code> are really the values pertaining
  43. to the table that the trigger is defined on.) Second, triggers can
  44. be defined to fire on multiple events in
  45. <span class="productname">PostgreSQL</span> (e.g., <code class="literal">ON INSERT OR
  46. UPDATE</code>), whereas the SQL standard only allows one. If a
  47. trigger is defined to fire on multiple events, it is represented as
  48. multiple rows in the information schema, one for each type of
  49. event. As a consequence of these two issues, the primary key of
  50. the view <code class="literal">triggers</code> is really
  51. <code class="literal">(trigger_catalog, trigger_schema, event_object_table,
  52. trigger_name, event_manipulation)</code> instead of
  53. <code class="literal">(trigger_catalog, trigger_schema, trigger_name)</code>,
  54. which is what the SQL standard specifies. Nonetheless, if you
  55. define your triggers in a manner that conforms with the SQL
  56. standard (trigger names unique in the schema and only one event
  57. type per trigger), this will not affect you.
  58. </p><div class="note"><h3 class="title">Note</h3><p>
  59. Prior to <span class="productname">PostgreSQL</span> 9.1, this view's columns
  60. <code class="structfield">action_timing</code>,
  61. <code class="structfield">action_reference_old_table</code>,
  62. <code class="structfield">action_reference_new_table</code>,
  63. <code class="structfield">action_reference_old_row</code>, and
  64. <code class="structfield">action_reference_new_row</code>
  65. were named
  66. <code class="structfield">condition_timing</code>,
  67. <code class="structfield">condition_reference_old_table</code>,
  68. <code class="structfield">condition_reference_new_table</code>,
  69. <code class="structfield">condition_reference_old_row</code>, and
  70. <code class="structfield">condition_reference_new_row</code>
  71. respectively.
  72. That was how they were named in the SQL:1999 standard.
  73. The new naming conforms to SQL:2003 and later.
  74. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="infoschema-triggered-update-columns.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="information-schema.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="infoschema-udt-privileges.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">36.55. <code class="literal">triggered_update_columns</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 36.57. <code class="literal">udt_privileges</code></td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1