DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

Поиск
Список
Период
Сортировка
Искать

DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Peter Smith <smithpb2250@gmail.com>
Дата:
Вложения:
Hi hackers.

(This is a DOCS improvement patch only)

This patch was originally in another thread, where it was suggested
[1] to post separately (here), since it is an independent improvement.

~

The "CREATE PUBLICATION" docs [2] say:
"This does not apply to a partitioned table, however."

It is ambiguous as to exactly what "this" refers to:
- does "this" mean just the '*' of the prior sentence?
- does "this" relate to the whole 'ONLY'/'*' discussion?

The patch removes the ambiguity. PSA v1.

======
[1] https://www.postgresql.org/message-id/19bc00e8-ed58-488d-a727-5bca2445b795%40gmail.com
[2] https://www.postgresql.org/docs/devel/sql-createpublication.html

Kind Regards,
Peter Smith.
Fujitsu Australia

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Oct 19, 2026, at 14:57, Peter Smith  wrote:
> 
> Hi hackers.
> 
> (This is a DOCS improvement patch only)
> 
> This patch was originally in another thread, where it was suggested
> [1] to post separately (here), since it is an independent improvement.
> 
> ~
> 
> The "CREATE PUBLICATION" docs [2] say:
> "This does not apply to a partitioned table, however."
> 
> It is ambiguous as to exactly what "this" refers to:
> - does "this" mean just the '*' of the prior sentence?
> - does "this" relate to the whole 'ONLY'/'*' discussion?
> 
> The patch removes the ambiguity. PSA v1.
> 
> ======
> [1] https://www.postgresql.org/message-id/19bc00e8-ed58-488d-a727-5bca2445b795%40gmail.com
> [2] https://www.postgresql.org/docs/devel/sql-createpublication.html
> 
> Kind Regards,
> Peter Smith.
> Fujitsu Australia
> 

I think this is an improvement by making the meaning of ONLY and * clearer.

I just have nit comment:
```
+      the publication, so they are never explicitly added to the publication.
```

“so they are never explicitly added to the publication” might be read as a child partition cannot be added explicitly, however I verified the following is valid:
```
CREATE TABLE p (id integer) PARTITION BY RANGE (id);
CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (100);
CREATE PUBLICATION pub FOR TABLE p, p1;
```

So, how about:
```
the publication, so they do not need to be explicitly added to the
publication.
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Mon, Oct 19, 2026 at 1:42 PM Chao Li  wrote:
>
>
>
> > On Oct 19, 2026, at 14:57, Peter Smith  wrote:
> >
> > Hi hackers.
> >
> > (This is a DOCS improvement patch only)
> >
> > This patch was originally in another thread, where it was suggested
> > [1] to post separately (here), since it is an independent improvement.
> >
> > ~
> >
> > The "CREATE PUBLICATION" docs [2] say:
> > "This does not apply to a partitioned table, however."
> >
> > It is ambiguous as to exactly what "this" refers to:
> > - does "this" mean just the '*' of the prior sentence?
> > - does "this" relate to the whole 'ONLY'/'*' discussion?
> >
> > The patch removes the ambiguity. PSA v1.
> >
> > ======
> > [1] https://www.postgresql.org/message-id/19bc00e8-ed58-488d-a727-5bca2445b795%40gmail.com
> > [2] https://www.postgresql.org/docs/devel/sql-createpublication.html
> >
> > Kind Regards,
> > Peter Smith.
> > Fujitsu Australia
> > 
>
> I think this is an improvement by making the meaning of ONLY and * clearer.
>
> I just have nit comment:
> ```
> +      the publication, so they are never explicitly added to the publication.
> ```
>
> “so they are never explicitly added to the publication” might be read as a child partition cannot be added explicitly, however I verified the following is valid:
> ```
> CREATE TABLE p (id integer) PARTITION BY RANGE (id);
> CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (100);
> CREATE PUBLICATION pub FOR TABLE p, p1;
> ```
>
> So, how about:
> ```
> the publication, so they do not need to be explicitly added to the
> publication.
> ```

+1. I had the same thought while reviewing. Although the goal here is
just to clarify the point about ONLY, we can also make the subsequent
sentence less ambiguous in the same patch.

thanks
Shveta


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Peter Smith <smithpb2250@gmail.com>
Дата:
Вложения:
On Mon, Oct 19, 2026 at 7:49 PM shveta malik  wrote:
>
> On Mon, Oct 19, 2026 at 1:42 PM Chao Li  wrote:
> >
...
> > I think this is an improvement by making the meaning of ONLY and * clearer.
> >
> > I just have nit comment:
> > ```
> > +      the publication, so they are never explicitly added to the publication.
> > ```
> >
> > “so they are never explicitly added to the publication” might be read as a child partition cannot be added explicitly, however I verified the following is valid:
> > ```
> > CREATE TABLE p (id integer) PARTITION BY RANGE (id);
> > CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (100);
> > CREATE PUBLICATION pub FOR TABLE p, p1;
> > ```
> >
> > So, how about:
> > ```
> > the publication, so they do not need to be explicitly added to the
> > publication.
> > ```
>
> +1. I had the same thought while reviewing. Although the goal here is
> just to clarify the point about ONLY, we can also make the subsequent
> sentence less ambiguous in the same patch.
>

Hi Chao and Shveta.

Thanks for your review comments. I agree with you.

PSA patch v2, which also fixes the misleading "never" wording in the
original sentence.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Takeshi Ideriha <iderihatakeshi@gmail.com>
Дата:
Hi all

> Thanks for your review comments. I agree with you.
> 
> PSA patch v2, which also fixes the misleading "never" wording in the
> original sentence.

Thank you for creating another thread per my suggestion.
The patch V2 looks good to me.

It's completely optional but I noticed that ALTER PUBLICATION doc [1]
also mentions ONLY and '*' though ALTER PUBLICATION doc does not mention
partitioned table at all. How about adding the similar note to ALTER
doc? I know the main purpose of this patch is to remove ambiguous
sentence from CREATE PUBLICATION doc. But it could be worthwhile to
clarify how postgres behaves also in ALTER doc.

I tested myself and ALTER also ignores ONLY and * for partitioned table
as well.

[1] https://www.postgresql.org/docs/devel/sql-alterpublication.html
---
Name of an existing table. If ONLY is specified before the table_name,
only that table is affected. If ONLY is not specified, the table and all
its descendant tables (if any) are affected. Optionally, * can be
specified after the table_name to explicitly indicate that descendant
tables are included.
---

Regards,
Takeshi Ideriha


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Tue, Oct 20, 2026 at 11:16 AM Takeshi Ideriha
 wrote:
> Thank you for creating another thread per my suggestion.
> The patch V2 looks good to me.

+1

> It's completely optional but I noticed that ALTER PUBLICATION doc [1]
> also mentions ONLY and '*' though ALTER PUBLICATION doc does not mention
> partitioned table at all. How about adding the similar note to ALTER
> doc? I know the main purpose of this patch is to remove ambiguous
> sentence from CREATE PUBLICATION doc. But it could be worthwhile to
> clarify how postgres behaves also in ALTER doc.

+1

The patch seems an improvement of the docs rather than fix of an incorrect
description. So it's sufficient to be committed only to master,
without backpatching
to stable branches?

Regards,


-- 
Fujii Masao


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Peter Smith <smithpb2250@gmail.com>
Дата:
Вложения:
On Tue, Oct 20, 2026 at 1:16 PM Takeshi Ideriha
 wrote:
>
> Hi all
>
> > Thanks for your review comments. I agree with you.
> >
> > PSA patch v2, which also fixes the misleading "never" wording in the
> > original sentence.
>
> Thank you for creating another thread per my suggestion.
> The patch V2 looks good to me.
>
> It's completely optional but I noticed that ALTER PUBLICATION doc [1]
> also mentions ONLY and '*' though ALTER PUBLICATION doc does not mention
> partitioned table at all. How about adding the similar note to ALTER
> doc? I know the main purpose of this patch is to remove ambiguous
> sentence from CREATE PUBLICATION doc. But it could be worthwhile to
> clarify how postgres behaves also in ALTER doc.
>

Hi Takeshi-San

Sure, I guess it makes sense for those paragraphs in CREATE and ALTER
to say the same thing.

(At least, it is easier to make them the same than to justify why they
shouldn't be.)

PSA v3.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Takeshi Ideriha <iderihatakeshi@gmail.com>
Дата:

> The patch seems an improvement of the docs rather than fix of an incorrect
> description. So it's sufficient to be committed only to master,
> without backpatching
> to stable branches?

+1
Current doc is not wrong. It seems to me pushing only to master is good.

Regards,
Takeshi Ideriha


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Takeshi Ideriha <iderihatakeshi@gmail.com>
Дата:
Hi Peter

> Hi Takeshi-San
> 
> Sure, I guess it makes sense for those paragraphs in CREATE and ALTER
> to say the same thing.
> 
> (At least, it is easier to make them the same than to justify why they
> shouldn't be.)
> 
> PSA v3.


Thank you for addressing my suggestion. V3 looks good to me. I also
believe the same wording works.

Regards,
Takeshi Ideriha



Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Tue, Oct 20, 2026 at 2:20 PM Takeshi Ideriha
 wrote:
> Thank you for addressing my suggestion. V3 looks good to me. I also
> believe the same wording works.

Thanks for updating the patch!

+      For a partitioned table, ONLY and *
+      have no effect: its partitions are always implicitly considered part of
+      the publication, so they do not need to be added explicitly.

In ALTER PUBLICATION, "table_name" also applies to DROP and EXCEPT,
so seems the original wording needs to account for those cases.
How about:

       For a partitioned table, ONLY and *
       have no effect.  When a partitioned table is included in a publication,
       its partitions are implicitly included as well and need not be added
       explicitly.  For tables specified in EXCEPT, see the
       description of
       EXCEPT
       in .


      
-
      

Why is this blank line removed?

Regards,

-- 
Fujii Masao


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Thu, Oct 22, 2026 at 1:44 PM Fujii Masao  wrote:
>
> On Tue, Oct 20, 2026 at 2:20 PM Takeshi Ideriha
>  wrote:
> > Thank you for addressing my suggestion. V3 looks good to me. I also
> > believe the same wording works.
>
> Thanks for updating the patch!
>
> +      For a partitioned table, ONLY and *
> +      have no effect: its partitions are always implicitly considered part of
> +      the publication, so they do not need to be added explicitly.
>
> In ALTER PUBLICATION, "table_name" also applies to DROP and EXCEPT,
> so seems the original wording needs to account for those cases.
> How about:
>
>        For a partitioned table, ONLY and *
>        have no effect.  When a partitioned table is included in a publication,
>        its partitions are implicitly included as well and need not be added
>        explicitly.  For tables specified in EXCEPT, see the
>        description of
>        EXCEPT
>        in .

+1.

>
>       
> -
>       
>
> Why is this blank line removed?
>
> Regards,
>
> --
> Fujii Masao


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Oct 22, 2026, at 16:14, Fujii Masao  wrote:
> 
> On Tue, Oct 20, 2026 at 2:20 PM Takeshi Ideriha
>  wrote:
>> Thank you for addressing my suggestion. V3 looks good to me. I also
>> believe the same wording works.
> 
> Thanks for updating the patch!
> 
> +      For a partitioned table, ONLY and *
> +      have no effect: its partitions are always implicitly considered part of
> +      the publication, so they do not need to be added explicitly.
> 
> In ALTER PUBLICATION, "table_name" also applies to DROP and EXCEPT,
> so seems the original wording needs to account for those cases.
> How about:
> 
>       For a partitioned table, ONLY and *
>       have no effect.  When a partitioned table is included in a publication,
>       its partitions are implicitly included as well and need not be added
>       explicitly.  For tables specified in EXCEPT, see the
>       description of
>       EXCEPT
>       in .
> 

I like the first part of your suggested change, “when a partitioned table is included in a publication”, but I don't think we need to mention EXCEPT separately. Maybe we could just replace “not be added explicitly” with “not be included explicitly”? I think that should cover the EXCEPT case as well.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
surya poondla <suryapoondla4@gmail.com>
Дата:

Hi Peter,

I looked at v3. I agree ONLY/* have no effect for partitioned tables in every ALTER PUBLICATION variant i.e OpenTableList() skips recursion
for RELKIND_PARTITIONED_TABLE regardless of ADD/SET/DROP/EXCEPT.

A few points,

1. Following on from Fujii's point that table_name in ALTER PUBLICATION also covers DROP, the new note explains ONLY/* only in
terms of adding, which leaves DROP unclear. For example:

    CREATE TABLE p (id int) PARTITION BY RANGE (id);
    CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (100);
    CREATE PUBLICATION c FOR TABLE p, p1;
    ALTER PUBLICATION c DROP TABLE p *;
    -- p1 remains in pg_publication_rel

whereas for a plain inheritance parent, DROP TABLE parent (without ONLY) also removes the child. Maybe worth saying that dropping a
partitioned table does not remove partitions that were added to the publication explicitly.

2. A minor point (pre-existing) In CREATE PUBLICATION, the same FOR TABLE entry already ends with "When a partitioned table is added to a
publication, all of its existing and future partitions are implicitly considered to be part of the publication...". Both the
old text and v3 repeat that a few lines above, so perhaps just "For a partitioned table, ONLY and * have no effect." is enough there.


Regards,
Surya Poondla

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Oct 23, 2026, at 02:36, surya poondla  wrote:
> 
> 
> Hi Peter,
> 
> I looked at v3. I agree ONLY/* have no effect for partitioned tables in every ALTER PUBLICATION variant i.e OpenTableList() skips recursion
> for RELKIND_PARTITIONED_TABLE regardless of ADD/SET/DROP/EXCEPT.
> 
> A few points,
> 
> 1. Following on from Fujii's point that table_name in ALTER PUBLICATION also covers DROP, the new note explains ONLY/* only in
> terms of adding, which leaves DROP unclear. For example:
> 
>     CREATE TABLE p (id int) PARTITION BY RANGE (id);
>     CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (0) TO (100);
>     CREATE PUBLICATION c FOR TABLE p, p1;
>     ALTER PUBLICATION c DROP TABLE p *;
>     -- p1 remains in pg_publication_rel
> 
> whereas for a plain inheritance parent, DROP TABLE parent (without ONLY) also removes the child. Maybe worth saying that dropping a
> partitioned table does not remove partitions that were added to the publication explicitly.
> 

I don’t think this is a normal usage that we want to prompt. I’m afraid that describing details of such an edge case may just make users confused. In the meantime, I would challenge if that’s a bug. IMO, dropping “p *” should drop p1.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Peter Smith <smithpb2250@gmail.com>
Дата:
Вложения:
Hi all,

I'm catching up on feedback from last week while I was away. The
suggestions seem to be pulling in different directions:

- Fujii-San: reworded the ALTER PUBLICATION note to account for
ADD/DROP/EXCEPT (Shveta: +1)
- Chao: liked the first part of that wording but doesn't think the
EXCEPT mention is needed
- Surya: pointed out that DROP is still unclear, and suggested
documenting that DROP TABLE p * doesn't remove explicitly-added
partitions
- Chao: documenting that uncommon case might just cause confusion

It's hard to reconcile all of these, but here is what I have done:

1. The debate is only about ALTER PUBLICATION, so I have split the
patch. 0001 now covers only CREATE PUBLICATION. It is the same as v2,
which was already reviewed and approved. (Surya, I saw your minor
point about the repeated "implicitly part of the publication" text in
CREATE. I kept 0001 the same as v2 since it was already approved, but
we can keep discussing if the committer prefers.)

2. 0002 covers only ALTER PUBLICATION. I fixed the newline mistake,
and changed the wording to be minimal:

   For a partitioned table, ONLY and * have no effect.

AFAIK, this should be accurate for ADD/SET/DROP/EXCEPT alike, and it
makes no claim about "adding", which was the problem with the earlier
wording. It also doesn't need to mention EXCEPT or describe DROP
semantics.

If anyone thinks the behaviour of DROP TABLE p * with explicitly-added
partitions is a bug, I think that deserves its own thread.

3. TBH, I have never been happy with how the ALTER PUBLICATION page is
structured. The DESCRIPTION describes the second, third, and fourth
"variants" inline, unlike other syntax pages where the clauses are
listed separately, so there is no clear place for clause-specific
notes. A single "table_name" covers multiple sub-commands, which means
any note about partitioned tables has to be true for all of them. We
have discussed rewriting that page before, and I hope it can be
tackled for PG20, but that is out of scope for this thread.

Both patches are intended for master only. Thoughts?

Kind Regards,
Peter Smith
Fujitsu Australia

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
surya poondla <suryapoondla4@gmail.com>
Дата:

Hi Peter,

Thanks for v4. Splitting the patch makes sense.

0001 looks good to me.

0002 also looks good to me. "For a partitioned table, ONLY and * have no
effect." is accurate for every ALTER PUBLICATION variant, and since
it no longer frames this in terms of adding, it addresses my concern
about DROP.

I agree the DROP TABLE p * behavior with explicitly-added partitions
is a separate question from this docs patch. If anyone wants to pursue it, a separate thread is the right place.

Both patches apply cleanly on master.

Regards,
Surya Poondla

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Peter Smith <smithpb2250@gmail.com>
Дата:
On Wed, Oct 28, 2026 at 7:16 AM surya poondla  wrote:
>
>
> Hi Peter,
>
> Thanks for v4. Splitting the patch makes sense.
>
> 0001 looks good to me.
>
> 0002 also looks good to me. "For a partitioned table, ONLY and * have no
> effect." is accurate for every ALTER PUBLICATION variant, and since
> it no longer frames this in terms of adding, it addresses my concern
> about DROP.
>
> I agree the DROP TABLE p * behavior with explicitly-added partitions
> is a separate question from this docs patch. If anyone wants to pursue it, a separate thread is the right place.
>
> Both patches apply cleanly on master.
>
> Regards,
> Surya Poondla

Thanks. AFAIK, this CF entry [1] can now be marked as "Ready for
Committer", unless somebody has more review comments?

======
[1] https://commitfest.postgresql.org/patch/7482/

Kind Regards,
Peter Smith
Fujitsu Australia


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
surya poondla <suryapoondla4@gmail.com>
Дата:

Hi Peter,

Yes, I marked the CF as "Ready for Comitter".

Regards,
Surya Poondla

Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Amit Kapila <amit.kapila16@gmail.com>
Дата:
On Fri, Nov 6, 2026 at 2:48 AM surya poondla  wrote:
>
> Yes, I marked the CF as "Ready for Comitter".
>

Pushed with a minor change. I didn't like the use of : to connect
sentences, so I replaced that and pushed.

-- 
With Regards,
Amit Kapila.


Re: DOCS - CREATE PUBLICATION wording re 'ONLY' for partitioned tables.

От:
Peter Smith <smithpb2250@gmail.com>
Дата:
On Fri, Nov 13, 2026 at 8:33 PM Amit Kapila  wrote:
>
> On Fri, Nov 6, 2026 at 2:48 AM surya poondla  wrote:
> >
> > Yes, I marked the CF as "Ready for Comitter".
> >
>
> Pushed with a minor change. I didn't like the use of : to connect
> sentences, so I replaced that and pushed.
>

Thanks for pushing. I've marked the CF entry [1] as committed.

======
1] https://commitfest.postgresql.org/patch/7482/

Kind Regards,
Peter Smith.
Fujitsu Australia


FAQ