public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
86+ messages / 2 participants
[nested] [flat]

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Small tweak of tab completion.
---
 src/bin/psql/tab-complete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9a404dc8ae..8b75ac9f4c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2463,7 +2463,7 @@ psql_completion(const char *text, int start, int end)
 /* DROP */
 	/* Complete DROP object with CASCADE / RESTRICT */
 	else if (Matches3("DROP",
-					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|PUBLICATION|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 					  MatchAny) ||
 			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Fix typo
---
 src/backend/catalog/pg_publication.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 6ee06c4f13..e628ea8815 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1,12 +1,12 @@
 /*-------------------------------------------------------------------------
  *
- * publication.c
+ * pg_publication.c
  *		publication C API manipulation
  *
  * Copyright (c) 2016, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		publication.c
+ *		pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Remove unused header files.
---
 src/backend/catalog/pg_publication.c   | 6 ------
 src/backend/commands/publicationcmds.c | 8 --------
 src/include/commands/replicationcmds.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index e628ea8815..89e15d8fa1 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -33,12 +33,6 @@
 #include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 167836d5c6..60de9eb61a 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -37,14 +37,6 @@
 #include "commands/event_trigger.h"
 #include "commands/replicationcmds.h"
 
-#include "executor/spi.h"
-
-#include "nodes/makefuncs.h"
-
-#include "parser/parse_clause.h"
-
-#include "replication/reorderbuffer.h"
-
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
diff --git a/src/include/commands/replicationcmds.h b/src/include/commands/replicationcmds.h
index aaea845895..f608231722 100644
--- a/src/include/commands/replicationcmds.h
+++ b/src/include/commands/replicationcmds.h
@@ -15,7 +15,6 @@
 #ifndef REPLICATIONCMDS_H
 #define REPLICATIONCMDS_H
 
-#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

--------------59E4A6E8D45ED944E56A77DD--




^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add documentation for pg_publication_tables view.
---
 doc/src/sgml/catalogs.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 70533405e2..ae33c56db7 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5375,7 +5375,8 @@ <title><structname>pg_publication_rel</structname></title>
   <para>
    The catalog <structname>pg_publication_rel</structname> contains the
    mapping between relations and publications in the database.  This is a
-   many-to-many mapping.
+   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
+   for a more user-friendly view of this information.
   </para>
 
   <table>
@@ -7729,6 +7730,11 @@ <title>System Views</title>
      </row>
 
      <row>
+      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
+      <entry>publications and their associated tables</entry>
+     </row>
+
+     <row>
       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
       <entry>information about replication origins, including replication progress</entry>
      </row>
@@ -9010,6 +9016,61 @@ <title><structname>pg_prepared_xacts</> Columns</title>
 
  </sect1>
 
+ <sect1 id="view-pg-publication-tables">
+  <title><structname>pg_publication_tables</structname></title>
+
+  <indexterm zone="view-pg-publication-tables">
+   <primary>pg_publication_tables</primary>
+  </indexterm>
+
+  <para>
+   The view <structname>pg_publication_tables</structname> provides
+   information about the mapping between publications and the tables they
+   contain.  Unlike the underlying
+   catalog <structname>pg_publication_rel</structname>, this view expands
+   publications defined as <literal>FOR ALL TABLES</literal>, so for such
+   publications there will be a row for each eligible table.
+  </para>
+
+  <table>
+   <title><structname>pg_publication_tables</structname> Columns</title>
+
+   <tgroup cols="4">
+    <thead>
+     <row>
+      <entry>Name</entry>
+      <entry>Type</entry>
+      <entry>References</entry>
+      <entry>Description</entry>
+     </row>
+    </thead>
+
+    <tbody>
+     <row>
+      <entry><structfield>pubname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
+      <entry>Name of publication</entry>
+     </row>
+
+     <row>
+      <entry><structfield>schemaname</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
+      <entry>Name of schema containing table</entry>
+     </row>
+
+     <row>
+      <entry><structfield>tablename</structfield></entry>
+      <entry><type>name</type></entry>
+      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
+      <entry>Name of table</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+ </sect1>
+
   <sect1 id="view-pg-replication-origin-status">
   <title><structname>pg_replication_origin_status</structname></title>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL
@ 2017-01-03 17:00 Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Peter Eisentraut @ 2017-01-03 17:00 UTC (permalink / raw)

Add missing clauses to documentation of DROP PUBLICATION.
---
 doc/src/sgml/ref/drop_publication.sgml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index d05d522041..1a1be579ad 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -21,7 +21,7 @@
 
  <refsynopsisdiv>
 <synopsis>
-DROP PUBLICATION <replaceable class="PARAMETER">name</replaceable> [, ...]
+DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
 </synopsis>
  </refsynopsisdiv>
 
@@ -43,6 +43,16 @@ <title>Parameters</title>
 
   <variablelist>
    <varlistentry>
+    <term><literal>IF EXISTS</literal></term>
+    <listitem>
+     <para>
+      Do not throw an error if the extension does not exist. A notice is issued
+      in this case.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -51,6 +61,17 @@ <title>Parameters</title>
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>CASCADE</literal></term>
+    <term><literal>RESTRICT</literal></term>
+
+    <listitem>
+     <para>
+      These key words do not have any effect, since there are no dependencies
+      on publications.
+     </para>
+    </listitem>
+   </varlistentry>
   </variablelist>
  </refsect1>
 
-- 
2.11.0


--------------59E4A6E8D45ED944E56A77DD
Content-Type: text/x-patch;
 name="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-fixup-Add-PUBLICATION-catalogs-and-DDL.patch"



^ permalink  raw  reply  [nested|flat] 86+ messages in thread

* [PATCH 3/6] Move conversion of a "historic" to MVCC snapshot to a separate function.
@ 2026-01-08 16:47 Antonin Houska <[email protected]>
  0 siblings, 0 replies; 86+ messages in thread

From: Antonin Houska @ 2026-01-08 16:47 UTC (permalink / raw)

The conversion is now handled by SnapBuildMVCCFromHistoric(). REPACK
CONCURRENTLY will also need it.
---
 src/backend/replication/logical/snapbuild.c | 57 +++++++++++++++++----
 src/backend/utils/time/snapmgr.c            |  3 +-
 src/include/replication/snapbuild.h         |  1 +
 src/include/utils/snapmgr.h                 |  1 +
 4 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index 7f79621b57e..95f230f8e9b 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -440,10 +440,7 @@ Snapshot
 SnapBuildInitialSnapshot(SnapBuild *builder)
 {
 	Snapshot	snap;
-	TransactionId xid;
 	TransactionId safeXid;
-	TransactionId *newxip;
-	int			newxcnt = 0;
 
 	Assert(XactIsoLevel == XACT_REPEATABLE_READ);
 	Assert(builder->building_full_snapshot);
@@ -485,7 +482,33 @@ SnapBuildInitialSnapshot(SnapBuild *builder)
 
 	MyProc->xmin = snap->xmin;
 
-	/* allocate in transaction context */
+	/* Convert the historic snapshot to MVCC snapshot. */
+	return SnapBuildMVCCFromHistoric(snap, true);
+}
+
+/*
+ * Turn a historic MVCC snapshot into an ordinary MVCC snapshot.
+ *
+ * Unlike a regular (non-historic) MVCC snapshot, the 'xip' array of this
+ * snapshot contains not only running main transactions, but also their
+ * subtransactions. On the other hand, 'subxip' will usually be empty. This
+ * difference does not affect the result of XidInMVCCSnapshot() because it
+ * searches both in 'xip' and 'subxip'.
+ *
+ * Pass true for 'in_place' if you don't care about modifying the source
+ * snapshot. If you need a new instance, and one that was allocated as a
+ * single chunk of memory, pass false.
+ */
+Snapshot
+SnapBuildMVCCFromHistoric(Snapshot snapshot, bool in_place)
+{
+	TransactionId xid;
+	TransactionId *oldxip = snapshot->xip;
+	uint32		oldxcnt = snapshot->xcnt;
+	TransactionId *newxip;
+	int			newxcnt = 0;
+	Snapshot	result;
+
 	newxip = palloc_array(TransactionId, GetMaxSnapshotXidCount());
 
 	/*
@@ -494,7 +517,7 @@ SnapBuildInitialSnapshot(SnapBuild *builder)
 	 * classical snapshot by marking all non-committed transactions as
 	 * in-progress. This can be expensive.
 	 */
-	for (xid = snap->xmin; NormalTransactionIdPrecedes(xid, snap->xmax);)
+	for (xid = snapshot->xmin; NormalTransactionIdPrecedes(xid, snapshot->xmax);)
 	{
 		void	   *test;
 
@@ -502,7 +525,7 @@ SnapBuildInitialSnapshot(SnapBuild *builder)
 		 * Check whether transaction committed using the decoding snapshot
 		 * meaning of ->xip.
 		 */
-		test = bsearch(&xid, snap->xip, snap->xcnt,
+		test = bsearch(&xid, snapshot->xip, snapshot->xcnt,
 					   sizeof(TransactionId), xidComparator);
 
 		if (test == NULL)
@@ -519,11 +542,25 @@ SnapBuildInitialSnapshot(SnapBuild *builder)
 	}
 
 	/* adjust remaining snapshot fields as needed */
-	snap->snapshot_type = SNAPSHOT_MVCC;
-	snap->xcnt = newxcnt;
-	snap->xip = newxip;
+	snapshot->xcnt = newxcnt;
+	snapshot->xip = newxip;
+
+	if (in_place)
+		result = snapshot;
+	else
+	{
+		result = CopySnapshot(snapshot);
+
+		/* Restore the original values so the source is intact. */
+		snapshot->xip = oldxip;
+		snapshot->xcnt = oldxcnt;
+
+		/* newxip has been copied */
+		pfree(newxip);
+	}
+	result->snapshot_type = SNAPSHOT_MVCC;
 
-	return snap;
+	return result;
 }
 
 /*
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index 2e6197f5f35..3af1b366adf 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -213,7 +213,6 @@ typedef struct ExportedSnapshot
 static List *exportedSnapshots = NIL;
 
 /* Prototypes for local functions */
-static Snapshot CopySnapshot(Snapshot snapshot);
 static void UnregisterSnapshotNoOwner(Snapshot snapshot);
 static void FreeSnapshot(Snapshot snapshot);
 static void SnapshotResetXmin(void);
@@ -604,7 +603,7 @@ SetTransactionSnapshot(Snapshot sourcesnap, VirtualTransactionId *sourcevxid,
  * The copy is palloc'd in TopTransactionContext and has initial refcounts set
  * to 0.  The returned snapshot has the copied flag set.
  */
-static Snapshot
+Snapshot
 CopySnapshot(Snapshot snapshot)
 {
 	Snapshot	newsnap;
diff --git a/src/include/replication/snapbuild.h b/src/include/replication/snapbuild.h
index ccded021433..34383dea776 100644
--- a/src/include/replication/snapbuild.h
+++ b/src/include/replication/snapbuild.h
@@ -73,6 +73,7 @@ extern void FreeSnapshotBuilder(SnapBuild *builder);
 extern void SnapBuildSnapDecRefcount(Snapshot snap);
 
 extern Snapshot SnapBuildInitialSnapshot(SnapBuild *builder);
+extern Snapshot SnapBuildMVCCFromHistoric(Snapshot snapshot, bool in_place);
 extern const char *SnapBuildExportSnapshot(SnapBuild *builder);
 extern void SnapBuildClearExportedSnapshot(void);
 extern void SnapBuildResetExportedSnapshotState(void);
diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h
index b8c01a291a1..de824945f0b 100644
--- a/src/include/utils/snapmgr.h
+++ b/src/include/utils/snapmgr.h
@@ -63,6 +63,7 @@ extern Snapshot GetTransactionSnapshot(void);
 extern Snapshot GetLatestSnapshot(void);
 extern void SnapshotSetCommandId(CommandId curcid);
 
+extern Snapshot CopySnapshot(Snapshot snapshot);
 extern Snapshot GetCatalogSnapshot(Oid relid);
 extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid);
 extern void InvalidateCatalogSnapshot(void);
-- 
2.47.3


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=v29-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch



^ permalink  raw  reply  [nested|flat] 86+ messages in thread


end of thread, other threads:[~2026-01-08 16:47 UTC | newest]

Thread overview: 86+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2017-01-03 17:00 [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL Peter Eisentraut <[email protected]>
2026-01-08 16:47 [PATCH 3/6] Move conversion of a "historic" to MVCC snapshot to a separate function. Antonin Houska <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox