Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1fe3325

Browse files
committed
Document that ONLY can be specified in publication commands
Author: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
1 parentb6dd127 commit1fe3325

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed

‎doc/src/sgml/ref/alter_publication.sgml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> WITH ( <repl
3131

3232
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER }
3333
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
34-
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> ADD TABLE <replaceable class="PARAMETER">table_name</replaceable> [, ...]
35-
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> SET TABLE <replaceable class="PARAMETER">table_name</replaceable> [, ...]
36-
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE <replaceable class="PARAMETER">table_name</replaceable> [, ...]
34+
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> ADD TABLE[ ONLY ]<replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
35+
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> SET TABLE[ ONLY ]<replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
36+
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE[ ONLY ]<replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
3737
</synopsis>
3838
</refsynopsisdiv>
3939

@@ -116,7 +116,11 @@ ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE <
116116
<term><replaceable class="parameter">table_name</replaceable></term>
117117
<listitem>
118118
<para>
119-
Name of an existing table.
119+
Name of an existing table. If <literal>ONLY</> is specified before the
120+
table name, only that table is affected. If <literal>ONLY</> is not
121+
specified, the table and all its descendant tables (if any) are
122+
affected. Optionally, <literal>*</> can be specified after the table
123+
name to explicitly indicate that descendant tables are included.
120124
</para>
121125
</listitem>
122126
</varlistentry>

‎doc/src/sgml/ref/create_publication.sgml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PostgreSQL documentation
2222
<refsynopsisdiv>
2323
<synopsis>
2424
CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
25-
[ FOR TABLE <replaceable class="parameter">table_name</replaceable> [, ...]
25+
[ FOR TABLE[ ONLY ]<replaceable class="parameter">table_name</replaceable> [ * ] [, ...]
2626
| FOR ALL TABLES ]
2727
[ WITH ( <replaceable class="parameter">option</replaceable> [, ... ] ) ]
2828

@@ -68,7 +68,12 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
6868
<term><literal>FOR TABLE</literal></term>
6969
<listitem>
7070
<para>
71-
Specifies a list of tables to add to the publication.
71+
Specifies a list of tables to add to the publication. If
72+
<literal>ONLY</> is specified before the table name, only
73+
that table is added to the publication. If <literal>ONLY</> is not
74+
specified, the table and all its descendant tables (if any) are added.
75+
Optionally, <literal>*</> can be specified after the table name to
76+
explicitly indicate that descendant tables are included.
7277
</para>
7378
</listitem>
7479
</varlistentry>

‎src/test/regress/expected/publication.out

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ Publications:
7171

7272
DROP TABLE testpub_tbl2;
7373
DROP PUBLICATION testpub_foralltables;
74+
CREATE TABLE testpub_tbl3 (a int);
75+
CREATE TABLE testpub_tbl3a (b text) INHERITS (testpub_tbl3);
76+
CREATE PUBLICATION testpub3 FOR TABLE testpub_tbl3;
77+
CREATE PUBLICATION testpub4 FOR TABLE ONLY testpub_tbl3;
78+
\dRp+ testpub3
79+
Publication testpub3
80+
Inserts | Updates | Deletes
81+
---------+---------+---------
82+
t | t | t
83+
Tables:
84+
"public.testpub_tbl3"
85+
"public.testpub_tbl3a"
86+
87+
\dRp+ testpub4
88+
Publication testpub4
89+
Inserts | Updates | Deletes
90+
---------+---------+---------
91+
t | t | t
92+
Tables:
93+
"public.testpub_tbl3"
94+
95+
DROP TABLE testpub_tbl3, testpub_tbl3a;
96+
DROP PUBLICATION testpub3, testpub4;
7497
-- fail - view
7598
CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_view;
7699
ERROR: "testpub_view" is not a table

‎src/test/regress/sql/publication.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ SELECT pubname, puballtables FROM pg_publication WHERE pubname = 'testpub_forall
4444
DROPTABLE testpub_tbl2;
4545
DROP PUBLICATION testpub_foralltables;
4646

47+
CREATETABLEtestpub_tbl3 (aint);
48+
CREATETABLEtestpub_tbl3a (btext) INHERITS (testpub_tbl3);
49+
CREATE PUBLICATION testpub3 FOR TABLE testpub_tbl3;
50+
CREATE PUBLICATION testpub4 FOR TABLE ONLY testpub_tbl3;
51+
\dRp+ testpub3
52+
\dRp+ testpub4
53+
54+
DROPTABLE testpub_tbl3, testpub_tbl3a;
55+
DROP PUBLICATION testpub3, testpub4;
56+
4757
-- fail - view
4858
CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_view;
4959
CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_tbl1,pub_test.testpub_nopk;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp