Re: Remove redundant assignment of a variable in function AlterPublicationTables

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Smith <smithpb2250(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Subject: Re: Remove redundant assignment of a variable in function AlterPublicationTables
Date: 2025-08-21 00:41:36
Message-ID: B65DC4FA-312B-4B8C-AB61-55BCA989699E@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Aug 21, 2025, at 08:11, Michael Paquier <michael(at)paquier(dot)xyz> 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 with its pointer, in this specific case, compilers won’t be able to do much optimization on “isnull”. It still needs to allocate “isnull” on stack and assign “true” to it at runtime. But anyway, that’s a tiny cost that we don’t need to worry about.

--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-08-21 01:07:33 Re: Reduce "Var IS [NOT] NULL" quals during constant folding
Previous Message Michael Paquier 2025-08-21 00:11:17 Re: Remove redundant assignment of a variable in function AlterPublicationTables