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 1p56o0-0005vA-Bq for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Dec 2022 15:02:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p56ny-00056I-5r for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Dec 2022 15:02:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p56nx-000569-PN for pgsql-hackers@lists.postgresql.org; Tue, 13 Dec 2022 15:02:49 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p56nv-0001ez-2x for pgsql-hackers@postgresql.org; Tue, 13 Dec 2022 15:02:48 +0000 Received: by mail-wr1-x42d.google.com with SMTP id i7so1286935wrv.8 for ; Tue, 13 Dec 2022 07:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=Y3NWyhmZjhU0r6IObIBNjJiW70ZG43LOiD0ag+Zz1EY=; b=67STUMh+B21SQGdYQXG6W1dIbLCw+TiM4DPPWJGkxaHLToMAdwb5PDbthhgtretro5 hVsnAvMlEgnl5XJkvkpdYWSba+1pwSLJ0l9+UZiP3CUzDll0zEe1sY5NUVel2QnJmZB0 gXTAGJcV+UtftQF3ZaCCx9GmgTpSG3D8GuoF69hoaenHlX8dunhtciQ/nmEi5fW3zrYX sbpO5ox3d0pfwKL1wWIWL0h2IY+TGRFsmTuk0yyH3wA+mUzhZKfEoh9BjpS5S8y37+Nq /D46Kygmy66/QE4Vsg4Oc0vsufM5EtWdhFx8JJ1btwfQr/Y1jtGeHXN2IuAu5SR44pQ+ GlzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y3NWyhmZjhU0r6IObIBNjJiW70ZG43LOiD0ag+Zz1EY=; b=CgAzl5sNXsI4CKEHdiapmu7MuRC4KyXtcH5S5Rg+FMKDFM3jSwTZ3HSwk1CmybjRpH BpvVhC015eu+O+fk3Rcdg5Ctesq2XbFpFapjVzjvDViAGaAuLa8VTOv7LF/jTE+pCmFN zlH7guPOUCwsxWSzZ1mKag5Jdfq791b10kqawe0zz/wFKbZw8EfPCxMeSbdQVO1TPe3t K3c4HSRkPKAHGT5CziaF2Tj276nCD/SZ4OSDbCRjbZU6k42/7bkApcUO9zu19dxpuogj ZnDe6aBSpdZFV+P4oPNidNsY0XmleiImUxYyzlt0VUhiqAtJfFWWSg3gBmIkf8Gv8vSZ TeNQ== X-Gm-Message-State: ANoB5pnxjG7yB4NZSLP48lT5eT52TDnCxCFivahmfu5H3W61hbYJCBMU FrkNDChFOc2BkoiB/BxW/UinhRmMXsbidCl/ X-Google-Smtp-Source: AA0mqf6+sFMX3UqcReF/uqcKBY+8mxQEWjA6aIHmIK1LhFn1ecvgPP73j/qOoD5gICVe+FaYiBHDig== X-Received: by 2002:a5d:4e82:0:b0:242:7139:601a with SMTP id e2-20020a5d4e82000000b002427139601amr12183181wru.28.1670943765678; Tue, 13 Dec 2022 07:02:45 -0800 (PST) Received: from antos ([88.103.134.108]) by smtp.gmail.com with ESMTPSA id i9-20020a5d5849000000b00242814c2cf0sm65413wrf.4.2022.12.13.07.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Dec 2022 07:02:44 -0800 (PST) From: Antonin Houska To: Peter Eisentraut cc: pgsql-hackers Subject: Re: refactor ExecGrant_*() functions In-reply-to: <21375e35-07a2-a60e-c36e-286a46c9fc47@enterprisedb.com> References: <22c7e802-4e7d-8d87-8b71-cba95e6f4bcf@enterprisedb.com> <24706.1670316118@antos> <4395c0b0-3938-5d87-27d1-cc99766745ce@enterprisedb.com> <3473.1670838279@antos> <21375e35-07a2-a60e-c36e-286a46c9fc47@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Tue, 13 Dec 2022 07:54:07 +0100." X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 28.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3238.1670943837.1@antos> Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Dec 2022 16:03:57 +0100 Message-ID: <3239.1670943837@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut wrote: > On 12.12.22 10:44, Antonin Houska wrote: > > Peter Eisentraut wrote: > > = > >> On 06.12.22 09:41, Antonin Houska wrote: > >>> Attached are my proposals for improvements. One is to avoid memory l= eak, the > >>> other tries to improve readability a little bit. > >> > >> I added the readability improvement to my v2 patch. The pfree() call= s aren't > >> necessary AFAICT. > = > It's something to consider, but since this is a refactoring patch and th= e old > code didn't do it either, I think it's out of scope. Well, the reason I brought this topic up is that the old code didn't even palloc() those arrays. (Because the were located in the stack.) > > I see that memory contexts exist and that the amount of memory freed i= s not > > huge, but my style is to free the memory explicitly if it's allocated = in a > > loop. > > v2 looks good to me. > = > Committed, thanks. ok, I'll post rebased "USAGE privilege on PUBLICATION" patch [1] soon. -- = Antonin Houska Web: https://www.cybertec-postgresql.com [1] https://commitfest.postgresql.org/41/3641/