Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f0UQQ-0002gH-Cg for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Mar 2018 15:52:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f0UQP-00032n-AH for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Mar 2018 15:52:45 +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.89) (envelope-from ) id 1f0UQO-0002qx-54 for pgsql-bugs@lists.postgresql.org; Mon, 26 Mar 2018 15:52:44 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f0UQK-0000gz-Ew for pgsql-bugs@lists.postgresql.org; Mon, 26 Mar 2018 15:52:43 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B69E22136A; Mon, 26 Mar 2018 11:52:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 26 Mar 2018 11:52:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=vkdNHXpKaZ379oNz9y/GoC10vCnnl sR3RCDZXTPmiXw=; b=RFtlMfk3aK0puHD7KPgGAQ3OFlSE5b9i9gkjDzUTGfYam 2N583iE+rGyPgcp8TsWBAIh5/CwYl6taDBnxsK9rgmU+c/99l36gg5GHWvbPxXez 2T2UZFS7LayPbJU+V2YQtfXuLi89GwDRxSfkZflRvE5cC2zaS9PD4/RudmE2Wfut 83EwEv8Mc+SEJvGQT2ikriuQNhf+cCFP2ciTJ/B4WvXKEbS016t1HChgoD6JA74e hzg24jex5YGlWQ44tlk6WePKzMWbjAJc8Kc6TNV3qH/qTfZf4zQx9rWmCHDxGIJn CclDvmgLMt+YErgEUW79GyAFWmhW5Aw5lLler3cNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=vkdNHX pKaZ379oNz9y/GoC10vCnnlsR3RCDZXTPmiXw=; b=aTdJ+uAvt1aGRs9XMoLxl9 BDlIdgFtpj8jzfqhkGsykadTrXjWGNCrN8cbmhsHre0XzWGxUxsyjVQdIe/KUiqZ hLenb8Q+d5Q/eFGeL9k2448V7cMfpEX8yJNGV1/cpqsHlxzj/e1AVluCO0V/2+Fl TDc1JLS8CzgevVBcvgmbblslqRTMityUUCdPEY1w+K7GGWBIaGhtgk4WltZsoQEB 3QAP2ITtbR00ho2GvvJXxVwIP8QXl284/IbXZ30ffibO5zKAZdBdBLsrT/Fr+wRG UYRkMpH17ipM5SQjC10HCfc3a6RhXF1VjR8rrgy1CTGXuA1Y5na/v+rVfJZVksqQ == X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 746D9E4408; Mon, 26 Mar 2018 11:52:38 -0400 (EDT) Date: Mon, 26 Mar 2018 08:52:37 -0700 From: Andres Freund To: =?utf-8?B?0J/QtdGC0YrRgCDQodC70LDQstC+0LI=?= , Petr Jelinek Cc: Alvaro Herrera , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15114: logical decoding Segmentation fault Message-ID: <20180326155237.i7qpurterx2iwg3c@alap3.anarazel.de> References: <152110589574.1223.17983600132321618383@wrigleys.postgresql.org> <20180315145627.k735cejk3zejuimi@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-03-15 23:55:32 +0100, Петър Славов wrote: > #0 GetActiveSnapshot () at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/time/snapmgr.c:843 > #1 0x00005649b753e928 in postquel_start (fcache=0x5649b89b7968, 2 > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/optimizer/util/clauses.c:2437 > #13 0x00005649b777181a in RelationGetIndexPredicate > (relation=relation@entry=0x7f76e7841568) > at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4813 > #14 0x00005649b7443d60 in BuildIndexInfo (index=index@entry=0x7f76e7841568) > at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/catalog/index.c:1660 > #15 0x00005649b7771b90 in RelationGetIndexAttrBitmap > (relation=relation@entry=0x7f76e7836638, > attrKind=attrKind@entry=INDEX_ATTR_BITMAP_IDENTITY_KEY) > at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/utils/cache/relcache.c:4938 > #16 0x00005649b7614368 in logicalrep_write_attrs (rel=0x7f76e7836638, > out=0x5649b88dee38) at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:530 > #17 logicalrep_write_rel (out=0x5649b88dee38, rel=0x7f76e7836638) at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/proto.c:317 > #18 0x00007f76998b5e6f in pgoutput_change (ctx=, > txn=, relation=0x7f76e7836638, change=0x5649b899b1f8) at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/pgoutput/pgoutput.c:324 > #19 0x00005649b760fbc9 in change_cb_wrapper (cache=, > txn=, relation=, change=) at > /build/postgresql-10-drhiey/postgresql-10-10.3/build/../src/backend/replication/logical/logical.c:711 Alvaro, Petr: If I understand correctly what happens here is that some *other* column than the replica identity has a predicate with a full blown SQL function. We shouldn't evaluate arbitrary code like that inside the otuput plugin! So RelationGetIndexAttrBitmap() builds a bitmap of *all* indexed columns. Besides the code exec problem above, this is also just inefficient. I think this needs to be replaced by some replident bespoke code? Greetings, Andres Freund