Re: Define variables in the approprieate scope

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Define variables in the approprieate scope
Date: 2020-03-23 16:00:24
Message-ID: 20200323160024.GA14345@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-Mar-18, Bruce Momjian wrote:

> On Tue, Feb 25, 2020 at 09:35:52AM +0100, Antonin Houska wrote:
> > I've noticed that two variables in RelationCopyStorage() are defined in a
> > scope higher than necessary. Please see the patch.
>
> It seems cleaner to me to allocate the variables once before the loop
> starts, rather than for each loop iteration.

If we're talking about personal preference, my own is what Antonin
shows. However, since disagreement has been expressed, I think we
should only change it if the generated code turns out better.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-03-23 16:04:17 Re: ASLR support for Postgres12
Previous Message Fujii Masao 2020-03-23 15:57:56 Re: replay pause vs. standby promotion