Re: Remove some unnecessary if-condition - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Remove some unnecessary if-condition
Date
Msg-id 20201014072256.GB12403@paquier.xyz
Whole thread Raw
In response to RE: Remove some unnecessary if-condition  ("Hou, Zhijie" <houzj.fnst@cn.fujitsu.com>)
List pgsql-hackers
On Mon, Oct 12, 2020 at 11:42:31AM +0000, Hou, Zhijie wrote:
> Thank you for reviewing! added it to commitfest
> https://commitfest.postgresql.org/30/2760/

-     if (!bootstrap)
-     {
-             pgstat_bestart();
-             CommitTransactionCommand();
-     }
+     pgstat_bestart();
+     CommitTransactionCommand();
FWIW, I prefer the original style here.  The if/elif dance is quite
long here so it can be easy to miss by reading the code that no
transaction commit should happen in bootstrap mode as this is
conditioned only by the top of the if logic.

I would also keep the code in reorderbuffer.c in its original shape,
because it does not actually hurt and changing it could introduce some
back-patching hazard, even if that be a conflict easy to fix.

There may be a point for the bit in informix.c, but similarly when you
think about back-patching I'd just keep it as it is.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Shinya Okano
Date:
Subject: Re: Add a description to the documentation that toast_tuple_target affects "Main"
Next
From: Luc Vlaming
Date:
Subject: Re: allow partial union-all and improve parallel subquery costing