pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: yxq@o2.pl
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14785: Logical replication does not work after adding a column. Bug?
Date: Mon, 25 Sep 2017 12:16:55 -0700
Message-ID: <20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de> (raw)
In-Reply-To: <def3109a-81b6-e6ab-e632-31c34434a90f@2ndquadrant.com>
References: <20170820191720.1454.19868@wrigleys.postgresql.org>
	<14aeb673-fded-e9dd-9e90-f04908f9eadf@2ndquadrant.com>
	<20170822193418.drjntpluvcidfqyf@alap3.anarazel.de>
	<4dfb4e26-9542-85d6-ff61-9e7080796b0e@2ndquadrant.com>
	<20170823163151.5dankkw7z72ltmvw@alap3.anarazel.de>
	<020d1ec1-70d6-a4e9-f7f6-ab7eed8f5985@2ndquadrant.com>
	<20170823213949.g7wpurzt6hbi3e5h@alap3.anarazel.de>
	<def3109a-81b6-e6ab-e632-31c34434a90f@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

On 2017-09-13 09:46:43 -0400, Peter Eisentraut wrote:
> 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.

Yes, I think that makes sense.

> +			/*
> +			 * Skip tables that look like they are from a heap rewrite (see
> +			 * make_new_heap()).  We need to skip them because the subscriber
> +			 * won't have a table by that name to receive the data.  That
> +			 * means we won't ship the new data in, say, an added column with
> +			 * a DEFAULT, but if the user applies the same DDL manually on the
> +			 * subscriber, then this will work out for them.
> +			 *
> +			 * We only need to consider the alltables case, because such a
> +			 * transient heap won't be an explicit member of a publication.
> +			 */
> +			if (pub->alltables)
> +			{
> +				char	   *relname = get_rel_name(relid);
> +				unsigned int u;
> +
> +				if (sscanf(relname, "pg_temp_%u", &u) == 1)
> +				{
> +					if (get_rel_relkind(u) == RELKIND_RELATION)
> +						break;
> +				}
> +			}
> +

This'll accept tablenames like pg_temp_1foo, right? Might be worth
being a bit narrower in the test.

Greetings,

Andres Freund


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



view thread (20+ messages)  latest in thread

Message-ID: <20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de>
Permalink:  ../20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, peter.eisentraut@2ndquadrant.com, yxq@o2.pl
  Subject: Re: BUG #14785: Logical replication does not work after adding a column. Bug?
  In-Reply-To: <20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de>
  References: <20170820191720.1454.19868@wrigleys.postgresql.org> <14aeb673-fded-e9dd-9e90-f04908f9eadf@2ndquadrant.com> <20170822193418.drjntpluvcidfqyf@alap3.anarazel.de> <4dfb4e26-9542-85d6-ff61-9e7080796b0e@2ndquadrant.com> <20170823163151.5dankkw7z72ltmvw@alap3.anarazel.de> <020d1ec1-70d6-a4e9-f7f6-ab7eed8f5985@2ndquadrant.com> <20170823213949.g7wpurzt6hbi3e5h@alap3.anarazel.de> <def3109a-81b6-e6ab-e632-31c34434a90f@2ndquadrant.com> <20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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