Define variables in the approprieate scope

2020-02-25 Thread Antonin Houska
I've noticed that two variables in RelationCopyStorage() are defined in a scope higher than necessary. Please see the patch. -- Antonin Houska Web: https://www.cybertec-postgresql.com diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c index fddfbf1d8c..14d170823f 100644 -

Re: Define variables in the approprieate scope

2020-03-18 Thread Bruce Momjian
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 i

Re: Define variables in the approprieate scope

2020-03-23 Thread Alvaro Herrera
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 bef

Re: Define variables in the approprieate scope

2020-03-23 Thread Bruce Momjian
On Mon, Mar 23, 2020 at 01:00:24PM -0300, Alvaro Herrera wrote: > 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

Re: Define variables in the approprieate scope

2020-03-23 Thread Michael Paquier
On Mon, Mar 23, 2020 at 08:50:55PM -0400, Bruce Momjian wrote: > On Mon, Mar 23, 2020 at 01:00:24PM -0300, Alvaro Herrera wrote: >> 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 th

Re: Define variables in the approprieate scope

2020-03-23 Thread Tom Lane
Michael Paquier writes: > On Mon, Mar 23, 2020 at 08:50:55PM -0400, Bruce Momjian wrote: >> I am fine with either usage, frankly. I was just pointing out what >> might be the benefit of the current coding. > Personal opinion here. I tend to prefer putting variable declarations > into the inner