gooderp18绿色标准版
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

50 lines
5.7KB

  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>30.1. Publication</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="logical-replication.html" title="Chapter 30. Logical Replication" /><link rel="next" href="logical-replication-subscription.html" title="30.2. Subscription" /></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">30.1. Publication</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="logical-replication.html" title="Chapter 30. Logical Replication">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="logical-replication.html" title="Chapter 30. Logical Replication">Up</a></td><th width="60%" align="center">Chapter 30. Logical Replication</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="logical-replication-subscription.html" title="30.2. Subscription">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="LOGICAL-REPLICATION-PUBLICATION"><div class="titlepage"><div><div><h2 class="title" style="clear: both">30.1. Publication</h2></div></div></div><p>
  3. A <em class="firstterm">publication</em> can be defined on any physical
  4. replication master. The node where a publication is defined is referred to
  5. as <em class="firstterm">publisher</em>. A publication is a set of changes
  6. generated from a table or a group of tables, and might also be described as
  7. a change set or replication set. Each publication exists in only one database.
  8. </p><p>
  9. Publications are different from schemas and do not affect how the table is
  10. accessed. Each table can be added to multiple publications if needed.
  11. Publications may currently only contain tables. Objects must be added
  12. explicitly, except when a publication is created for <code class="literal">ALL
  13. TABLES</code>.
  14. </p><p>
  15. Publications can choose to limit the changes they produce to
  16. any combination of <code class="command">INSERT</code>, <code class="command">UPDATE</code>,
  17. <code class="command">DELETE</code>, and <code class="command">TRUNCATE</code>, similar to how triggers are fired by
  18. particular event types. By default, all operation types are replicated.
  19. </p><p>
  20. A published table must have a <span class="quote">“<span class="quote">replica identity</span>”</span> configured in
  21. order to be able to replicate <code class="command">UPDATE</code>
  22. and <code class="command">DELETE</code> operations, so that appropriate rows to
  23. update or delete can be identified on the subscriber side. By default,
  24. this is the primary key, if there is one. Another unique index (with
  25. certain additional requirements) can also be set to be the replica
  26. identity. If the table does not have any suitable key, then it can be set
  27. to replica identity <span class="quote">“<span class="quote">full</span>”</span>, which means the entire row becomes
  28. the key. This, however, is very inefficient and should only be used as a
  29. fallback if no other solution is possible. If a replica identity other
  30. than <span class="quote">“<span class="quote">full</span>”</span> is set on the publisher side, a replica identity
  31. comprising the same or fewer columns must also be set on the subscriber
  32. side. See <a class="xref" href="sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY"><code class="literal">REPLICA IDENTITY</code></a> for details on
  33. how to set the replica identity. If a table without a replica identity is
  34. added to a publication that replicates <code class="command">UPDATE</code>
  35. or <code class="command">DELETE</code> operations then
  36. subsequent <code class="command">UPDATE</code> or <code class="command">DELETE</code>
  37. operations will cause an error on the publisher. <code class="command">INSERT</code>
  38. operations can proceed regardless of any replica identity.
  39. </p><p>
  40. Every publication can have multiple subscribers.
  41. </p><p>
  42. A publication is created using the <a class="xref" href="sql-createpublication.html" title="CREATE PUBLICATION"><span class="refentrytitle">CREATE PUBLICATION</span></a>
  43. command and may later be altered or dropped using corresponding commands.
  44. </p><p>
  45. The individual tables can be added and removed dynamically using
  46. <a class="xref" href="sql-alterpublication.html" title="ALTER PUBLICATION"><span class="refentrytitle">ALTER PUBLICATION</span></a>. Both the <code class="literal">ADD
  47. TABLE</code> and <code class="literal">DROP TABLE</code> operations are
  48. transactional; so the table will start or stop replicating at the correct
  49. snapshot once the transaction has committed.
  50. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="logical-replication.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="logical-replication.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="logical-replication-subscription.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 30. Logical Replication </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 30.2. Subscription</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1