Re: BUG #14785: Logical replication does not work after adding a column. Bug?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: yxq(at)o2(dot)pl, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14785: Logical replication does not work after adding a column. Bug?
Date: 2017-09-25 19:16:55
Message-ID: 20170925191655.xcn3tsnuibep3jro@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2017-09-25 19:26:51 Re: Query planner skipping index depending on DISTINCT parameter order (2)
Previous Message Sebastian Gröbler 2017-09-25 18:55:08 Re: Segmentation fault mayhem