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 1oRx8B-0002N9-6n for pgsql-committers@arkaria.postgresql.org; Sat, 27 Aug 2022 14:49:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oRx88-0004GA-Ff for pgsql-committers@arkaria.postgresql.org; Sat, 27 Aug 2022 14:49:48 +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 1oRx88-0004CQ-81 for pgsql-committers@lists.postgresql.org; Sat, 27 Aug 2022 14:49:48 +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 1oRx83-0006ba-1u for pgsql-committers@lists.postgresql.org; Sat, 27 Aug 2022 14:49:44 +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 27REndWa2342338; Sat, 27 Aug 2022 10:49:39 -0400 From: Tom Lane To: Justin Pryzby cc: Peter Eisentraut , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Remove unnecessary casts in free() and pfree() In-reply-to: <2295181.1661609717@sss.pgh.pa.us> References: <20220827112304.GL2342@telsasoft.com> <2295181.1661609717@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 27 Aug 2022 10:15:17 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2342336.1661611779.1@sss.pgh.pa.us> Date: Sat, 27 Aug 2022 10:49:39 -0400 Message-ID: <2342337.1661611779@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Justin Pryzby writes: >> This seems to be breaking cfbot's "warnings" test. > Hmm, well, casting away const is certainly not within pfree's remit, > so I'm glad we changed this. Oh, I see: sepgsql's quote_object_name() is doing const char *temp; temp = quote_identifier(src1); appendStringInfoString(&result, temp); if (src1 != temp) pfree(temp); evidently because whoever wrote this felt a compulsion to override quote_identifier's judgment that possibly leaking the quoted identifier wasn't worth worrying about. I think we should just nuke this code altogether and write appendStringInfoString(&result, quote_identifier(src1)); regards, tom lane