Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-21 Thread Michael Paquier
On Fri, Aug 22, 2025 at 09:55:23AM +1000, Peter Smith wrote: > To summarise: > Only ~4 places are redundantly assigning isNull values before calling > functions that use &isNull. > But ~400 function calls that are passing &isNull do not pre-assignment > of that variable. > > Choosing to keep this

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-21 Thread Peter Smith
On Thu, Aug 21, 2025 at 10:11 AM Michael Paquier wrote: ... > > It does not matter to leave the code as is. We have a bunch of these > depending on how people feel on the day when they implement something. > Hi Michael. Some declaration assignments may be arbitrary, but I think 'isNull' follows

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Chao Li
> On Aug 21, 2025, at 09:10, Peter Smith wrote: > > I feel that having redundant assignments can be misleading because > someone reading the code might think the initial value matters or has > some significance, when it does not. > > ~~~ > > Here's another example, in the same function: > ---

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Peter Smith
On Wed, Aug 20, 2025 at 6:41 PM Shlok Kyal wrote: > > Hi, > > While working on the thread [1]. We encountered that in the > 'AlterPublicationTables' function, the assignment 'isnull = true' is > redundant. This assignment is not required, and the variable will be > reassigned before use. > I have

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Chao Li
> On Aug 21, 2025, at 08:11, Michael Paquier wrote: > > Compilers are smart enough to optimize such things away My first impression was compilers would optimize the local variable “isnull", such as replacing it with a constant value. However, “isnull” will be passed into other functions wit

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 05:18:53PM +0800, Chao Li wrote: > If we look into the subsequent functions, yes, “isnull” will always > be assigned. But how about if someone incidentally changed a > subsequent function and moved an assignment? > I think giving an initial value is a good habit without much

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Chao Li
> On Aug 20, 2025, at 16:41, Shlok Kyal wrote: > > Hi, > > While working on the thread [1]. We encountered that in the > 'AlterPublicationTables' function, the assignment 'isnull = true' is > redundant. This assignment is not required, and the variable will be > reassigned before use. > I have

Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Shlok Kyal
Hi, While working on the thread [1]. We encountered that in the 'AlterPublicationTables' function, the assignment 'isnull = true' is redundant. This assignment is not required, and the variable will be reassigned before use. I have attached a patch to address this. [1]: https://www.postgresql.or