]> begriffs open source - ai-pg/blob - full-docs/html/logical-replication-restrictions.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / logical-replication-restrictions.html
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>29.8. Restrictions</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 Vsnapshot" /><link rel="prev" href="logical-replication-conflicts.html" title="29.7. Conflicts" /><link rel="next" href="logical-replication-architecture.html" title="29.9. Architecture" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">29.8. Restrictions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="logical-replication-conflicts.html" title="29.7. Conflicts">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="logical-replication.html" title="Chapter 29. Logical Replication">Up</a></td><th width="60%" align="center">Chapter 29. Logical Replication</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="logical-replication-architecture.html" title="29.9. Architecture">Next</a></td></tr></table><hr /></div><div class="sect1" id="LOGICAL-REPLICATION-RESTRICTIONS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">29.8. Restrictions <a href="#LOGICAL-REPLICATION-RESTRICTIONS" class="id_link">#</a></h2></div></div></div><p>
3    Logical replication currently has the following restrictions or missing
4    functionality.  These might be addressed in future releases.
5   </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
6      The database schema and DDL commands are not replicated.  The initial
7      schema can be copied by hand using <code class="literal">pg_dump
8      --schema-only</code>.  Subsequent schema changes would need to be kept
9      in sync manually.  (Note, however, that there is no need for the schemas
10      to be absolutely the same on both sides.)  Logical replication is robust
11      when schema definitions change in a live database: When the schema is
12      changed on the publisher and replicated data starts arriving at the
13      subscriber but does not fit into the table schema, replication will error
14      until the schema is updated.  In many cases, intermittent errors can be
15      avoided by applying additive schema changes to the subscriber first.
16     </p></li><li class="listitem"><p>
17      Sequence data is not replicated.  The data in serial or identity columns
18      backed by sequences will of course be replicated as part of the table,
19      but the sequence itself would still show the start value on the
20      subscriber.  If the subscriber is used as a read-only database, then this
21      should typically not be a problem.  If, however, some kind of switchover
22      or failover to the subscriber database is intended, then the sequences
23      would need to be updated to the latest values, either by copying the
24      current data from the publisher (perhaps
25      using <code class="command">pg_dump</code>) or by determining a sufficiently high
26      value from the tables themselves.
27     </p></li><li class="listitem"><p>
28      Replication of <code class="command">TRUNCATE</code> commands is supported, but
29      some care must be taken when truncating groups of tables connected by
30      foreign keys.  When replicating a truncate action, the subscriber will
31      truncate the same group of tables that was truncated on the publisher,
32      either explicitly specified or implicitly collected via
33      <code class="literal">CASCADE</code>, minus tables that are not part of the
34      subscription.  This will work correctly if all affected tables are part
35      of the same subscription.  But if some tables to be truncated on the
36      subscriber have foreign-key links to tables that are not part of the same
37      (or any) subscription, then the application of the truncate action on the
38      subscriber will fail.
39     </p></li><li class="listitem"><p>
40      Large objects (see <a class="xref" href="largeobjects.html" title="Chapter 33. Large Objects">Chapter 33</a>) are not replicated.
41      There is no workaround for that, other than storing data in normal
42      tables.
43     </p></li><li class="listitem"><p>
44      Replication is only supported by tables, including partitioned tables.
45      Attempts to replicate other types of relations, such as views, materialized
46      views, or foreign tables, will result in an error.
47     </p></li><li class="listitem"><p>
48      When replicating between partitioned tables, the actual replication
49      originates, by default, from the leaf partitions on the publisher, so
50      partitions on the publisher must also exist on the subscriber as valid
51      target tables. (They could either be leaf partitions themselves, or they
52      could be further subpartitioned, or they could even be independent
53      tables.)  Publications can also specify that changes are to be replicated
54      using the identity and schema of the partitioned root table instead of
55      that of the individual leaf partitions in which the changes actually
56      originate (see
57      <a class="link" href="sql-createpublication.html#SQL-CREATEPUBLICATION-PARAMS-WITH-PUBLISH-VIA-PARTITION-ROOT"><code class="literal">publish_via_partition_root</code></a>
58      parameter of <code class="command">CREATE PUBLICATION</code>).
59     </p></li><li class="listitem"><p>
60      When using
61      <a class="link" href="sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY-FULL"><code class="literal">REPLICA IDENTITY FULL</code></a>
62      on published tables, it is important to note that the <code class="literal">UPDATE</code>
63      and <code class="literal">DELETE</code> operations cannot be applied to subscribers
64      if the tables include attributes with datatypes (such as point or box)
65      that do not have a default operator class for B-tree or Hash. However,
66      this limitation can be overcome by ensuring that the table has a primary
67      key or replica identity defined for it.
68     </p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="logical-replication-conflicts.html" title="29.7. Conflicts">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="logical-replication.html" title="Chapter 29. Logical Replication">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="logical-replication-architecture.html" title="29.9. Architecture">Next</a></td></tr><tr><td width="40%" align="left" valign="top">29.7. Conflicts </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 29.9. Architecture</td></tr></table></div></body></html>