CREATE PUBLICATION and foreign partitions
Thread notes
1 note#bug
hackorum-bot#bug
@global #bug
Hello all!
Currently, according to logical replication restriction sections at [1]https://www.postgresql.org/docs/devel/logical-replication-restrictions.html,
"Attempts to replicate ... foreign tables, will result in an error."
But we don't care about partitioned tables with foreign partitions.
As we discussed here
/messages/by-id/CAA4eK1Lhh4SgiYQLNiWSNKGdVSzbd53=sr2tQCKooEphDkUtgw@mail.gmail.com
we decided to discuss this issue separately.
I have attached patch for this issue.
The correction only applies to the case "CREATE PUBLICATION FOR TABLE",
but no "FOR ALL TABLES" and "TABLES IN SCHEMA" because table list built
during subscription.
And I have another patch that filters partitioned tables at subscription
time, but we can't throw an error in that case. I'm not sure if it's
interesting, because it changes the behavior
[1]: https://www.postgresql.org/docs/devel/logical-replication-restrictions.html
https://www.postgresql.org/docs/devel/logical-replication-restrictions.html
On Wed, 29 Jan 2025 at 11:49, Sergey Tatarintsev
<s.tatarintsev@postgrespro.ru> wrote:
Hello all!
Currently, according to logical replication restriction sections at [1],
"Attempts to replicate ... foreign tables, will result in an error."But we don't care about partitioned tables with foreign partitions.
As we discussed here
/messages/by-id/CAA4eK1Lhh4SgiYQLNiWSNKGdVSzbd53=sr2tQCKooEphDkUtgw@mail.gmail.com
we decided to discuss this issue separately.
I have attached patch for this issue.The correction only applies to the case "CREATE PUBLICATION FOR TABLE",
but no "FOR ALL TABLES" and "TABLES IN SCHEMA" because table list built
during subscription.
And I have another patch that filters partitioned tables at subscription
time, but we can't throw an error in that case. I'm not sure if it's
interesting, because it changes the behavior
I felt that we should keep the behavior consistent for all the three
scenarios i.e. table/tables in schema/all tables publication.
Furthermore, we should account for the reverse scenario: if a
publication is present for a table, an error should be thrown if we
attempt to attach a partitioned table with a foreign table to the
published table.
I noticed these are handled in the patch that Shlok has provided at [1]/messages/by-id/CANhcyEWTNKm-ewnOVL9EB4MA-Zbt8BP1rmuXtD=TVHKmXL3xGA@mail.gmail.com.
[1]: /messages/by-id/CANhcyEWTNKm-ewnOVL9EB4MA-Zbt8BP1rmuXtD=TVHKmXL3xGA@mail.gmail.com
Regards,
Vignesh