Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwYsI-0004AQ-49 for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Sep 2017 19:17:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dwYsH-0006oZ-N9 for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Sep 2017 19:17:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dwYsH-0006oQ-Bp for pgsql-bugs@postgresql.org; Mon, 25 Sep 2017 19:17:01 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dwYsE-0005Ic-EA for pgsql-bugs@postgresql.org; Mon, 25 Sep 2017 19:17:00 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0506921A2A; Mon, 25 Sep 2017 15:16:57 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 25 Sep 2017 15:16:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=z1ZNoYc9b1tsmBOPkk ilBW+ww/MedmZI3AdAzWNe304=; b=Ja9oXKGA5dc6SBqhI+Y9dtOLmnL0JYxVKV t/Eb1U//gU3ff7kmPZSK44Qtmt+WM77cOkKGkN/tLoCN7iUAtoaxYjaW0tYbtqbs rg/urPlD8Weozy63dZxK/O/SNB5yTZeg1N73pziE1by+RV5qeh7fBXgAO+ns+Tre Ln5FbDcWJyYUQsV+tMve2kKbQJamCGXxLwVwu3hzDOpfyMIPg9p+68tS3lsErKkr sjqnzvzwETQ9BFI3UCWVb0J+PupmE/CsDcWarAKMOJ4qcoPIrU2gst7u04HUuM0L 7rR4dBLlAJzkgk8Rh5vwkMIjGGMHjttt/ftanScBfvxF258gV2+A== X-ME-Sender: X-Sasl-enc: Rlg+/PJtAvf5WfwHt2eMt/3jzBkRG3O1sBTjr/grXMB4 1506367016 Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id AC6F27E22C; Mon, 25 Sep 2017 15:16:56 -0400 (EDT) Date: Mon, 25 Sep 2017 12:16:55 -0700 From: Andres Freund To: Peter Eisentraut Cc: yxq@o2.pl, pgsql-bugs@postgresql.org Subject: Re: BUG #14785: Logical replication does not work after adding a column. Bug? Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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