gooderp18绿色标准版
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

35 lines
4.2KB

  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>40.6. Rules and Command Status</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="rules-privileges.html" title="40.5. Rules and Privileges" /><link rel="next" href="rules-triggers.html" title="40.7. Rules Versus Triggers" /></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">40.6. Rules and Command Status</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="rules-privileges.html" title="40.5. Rules and Privileges">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="rules.html" title="Chapter 40. The Rule System">Up</a></td><th width="60%" align="center">Chapter 40. The Rule System</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="rules-triggers.html" title="40.7. Rules Versus Triggers">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="RULES-STATUS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">40.6. Rules and Command Status</h2></div></div></div><p>
  3. The <span class="productname">PostgreSQL</span> server returns a command
  4. status string, such as <code class="literal">INSERT 149592 1</code>, for each
  5. command it receives. This is simple enough when there are no rules
  6. involved, but what happens when the query is rewritten by rules?
  7. </p><p>
  8. Rules affect the command status as follows:
  9. </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
  10. If there is no unconditional <code class="literal">INSTEAD</code> rule for the query, then
  11. the originally given query will be executed, and its command
  12. status will be returned as usual. (But note that if there were
  13. any conditional <code class="literal">INSTEAD</code> rules, the negation of their qualifications
  14. will have been added to the original query. This might reduce the
  15. number of rows it processes, and if so the reported status will
  16. be affected.)
  17. </p></li><li class="listitem"><p>
  18. If there is any unconditional <code class="literal">INSTEAD</code> rule for the query, then
  19. the original query will not be executed at all. In this case,
  20. the server will return the command status for the last query
  21. that was inserted by an <code class="literal">INSTEAD</code> rule (conditional or
  22. unconditional) and is of the same command type
  23. (<code class="command">INSERT</code>, <code class="command">UPDATE</code>, or
  24. <code class="command">DELETE</code>) as the original query. If no query
  25. meeting those requirements is added by any rule, then the
  26. returned command status shows the original query type and
  27. zeroes for the row-count and OID fields.
  28. </p></li></ul></div><p>
  29. </p><p>
  30. The programmer can ensure that any desired <code class="literal">INSTEAD</code> rule is the one
  31. that sets the command status in the second case, by giving it the
  32. alphabetically last rule name among the active rules, so that it
  33. gets applied last.
  34. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="rules-privileges.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="rules.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="rules-triggers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">40.5. Rules and Privileges </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 40.7. Rules Versus Triggers</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1