Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzTSI-0002w9-5e for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Dec 2021 00:56:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mzTSG-0004jZ-Qm for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Dec 2021 00:56:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzTSG-0004jQ-IL for pgsql-hackers@lists.postgresql.org; Tue, 21 Dec 2021 00:56:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzTSE-0000kS-1u for pgsql-hackers@lists.postgresql.org; Tue, 21 Dec 2021 00:56:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1BL0uQ6M2683411; Mon, 20 Dec 2021 19:56:26 -0500 From: Tom Lane To: Greg Nancarrow cc: Alvaro Herrera , Peter Eisentraut , Peter Smith , PostgreSQL Hackers Subject: Re: PublicationActions - use bit flags. In-reply-to: References: <3b7f2bdd-77ed-00d7-437c-dd9c37e6a2fa@enterprisedb.com> <202112201714.ql732mnfdrtc@alvherre.pgsql> Comments: In-reply-to Greg Nancarrow message dated "Tue, 21 Dec 2021 11:19:16 +1100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2683409.1640048186.1@sss.pgh.pa.us> Date: Mon, 20 Dec 2021 19:56:26 -0500 Message-ID: <2683410.1640048186@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Greg Nancarrow writes: > I've attached a patch which addresses that and replaces a couple of > memcpy()s with struct assignment, as suggested. Removing this is not good: if (relation->rd_pubactions) - { pfree(relation->rd_pubactions); - relation->rd_pubactions = NULL; - } If the subsequent palloc fails, you've created a problem where there was none before. I do wonder why we have to palloc a constant-size substructure in the first place, especially one that is likely smaller than the pointer that points to it. Maybe the struct definition should be moved so that we can just declare it in-line in the relcache entry? regards, tom lane