pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Handle heap rewrites better in logical replication
2+ messages / 1 participants
[nested] [flat]

* pgsql: Handle heap rewrites better in logical replication
@ 2017-09-26 14:30 Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2017-09-26 14:30 UTC (permalink / raw)
  To: pgsql-committers

Handle heap rewrites better in logical replication

A FOR ALL TABLES publication naturally considers all base tables to be a
candidate for replication.  This includes transient heaps that are
created during a table rewrite during DDL.  This causes failures on the
subscriber side because it will not have a table like pg_temp_16386 to
receive data (and if it did, it would be the wrong table).

The prevent this problem, we filter out any tables that match this
naming pattern and match an actual table from FOR ALL TABLES
publications.  This is only a heuristic, meaning that user tables that
match that naming could accidentally be omitted.  A more robust solution
might require an explicit marking of such tables in pg_class somehow.

Reported-by: yxq <yxq@o2.pl>
Bug: #14785
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Petr Jelinek <petr.jelinek@2ndquadrant.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ab28feae2bd3d4629bd73ae3548e671c57d785f0

Modified Files
--------------
src/backend/replication/pgoutput/pgoutput.c | 26 ++++++++++
src/test/subscription/t/006_rewrite.pl      | 73 +++++++++++++++++++++++++++++
2 files changed, 99 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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

* pgsql: Handle heap rewrites better in logical replication
@ 2017-09-26 14:30 Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2017-09-26 14:30 UTC (permalink / raw)
  To: pgsql-committers

Handle heap rewrites better in logical replication

A FOR ALL TABLES publication naturally considers all base tables to be a
candidate for replication.  This includes transient heaps that are
created during a table rewrite during DDL.  This causes failures on the
subscriber side because it will not have a table like pg_temp_16386 to
receive data (and if it did, it would be the wrong table).

The prevent this problem, we filter out any tables that match this
naming pattern and match an actual table from FOR ALL TABLES
publications.  This is only a heuristic, meaning that user tables that
match that naming could accidentally be omitted.  A more robust solution
might require an explicit marking of such tables in pg_class somehow.

Reported-by: yxq <yxq@o2.pl>
Bug: #14785
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Petr Jelinek <petr.jelinek@2ndquadrant.com>

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1a499c252049dad9016a04bcbab27b8c616d4d03

Modified Files
--------------
src/backend/replication/pgoutput/pgoutput.c | 26 ++++++++++
src/test/subscription/t/006_rewrite.pl      | 73 +++++++++++++++++++++++++++++
2 files changed, 99 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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


end of thread, other threads:[~2017-09-26 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26 14:30 pgsql: Handle heap rewrites better in logical replication Peter Eisentraut <peter_e@gmx.net>
2017-09-26 14:30 pgsql: Handle heap rewrites better in logical replication Peter Eisentraut <peter_e@gmx.net>

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