On 1/3/17 2:39 PM, Peter Eisentraut wrote: > In 0001-Add-PUBLICATION-catalogs-and-DDL-v16.patch.gz,
Attached are a couple of small fixes for this. Feel free to ignore the removal of the header files if they are needed by later patches. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>From d1a509cee9e1c2f6c9c4503f19e55520d8b6617f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Tue, 3 Jan 2017 12:00:00 -0500 Subject: [PATCH 1/5] fixup! Add PUBLICATION catalogs and DDL 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
>From 173215232e14ae209373fd69c936fa71ae3b1758 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Tue, 3 Jan 2017 12:00:00 -0500 Subject: [PATCH 2/5] fixup! Add PUBLICATION catalogs and DDL 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
>From 1755433aa69d20b9bcd9520ac65e7ee4d42ff124 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Tue, 3 Jan 2017 12:00:00 -0500 Subject: [PATCH 3/5] fixup! Add PUBLICATION catalogs and DDL 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
>From da31845bbddc24c9b1885efddeb295f8a93f2158 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Tue, 3 Jan 2017 12:00:00 -0500 Subject: [PATCH 4/5] fixup! Add PUBLICATION catalogs and DDL 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
>From bee09731d4dedfb98b56c1e1511092f9b2b4f8ab Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Tue, 3 Jan 2017 12:00:00 -0500 Subject: [PATCH 5/5] fixup! Add PUBLICATION catalogs and DDL 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
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers