Re: Slight refactoring of state check in pg_upgrade check_ function

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Slight refactoring of state check in pg_upgrade check_ function
Date: 2022-08-28 22:06:09
Message-ID: 20220828220609.GA338976@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 28, 2022 at 10:42:24PM +0200, Daniel Gustafsson wrote:
> I noticed that the pg_upgrade check_ functions were determining failures found
> in a few different ways. Some keep a boolen flag variable, and some (like
> check_for_incompatible_polymorphics) check the state of the script filehandle
> which is guaranteed to be set (with the error message referring to the path of
> said file). Others like check_loadable_libraries only check the flag variable
> and fclose the handle assuming it was opened.
>
> The attached diff changes the functions to do it consistently in one way, by
> checking the state of the filehandle. Since we are referring to the file by
> path in the printed error message it seemed the cleanest approach, and it saves
> a few lines of code without IMO reducing readability.
>
> There is no change in functionality, just code consistency.

The patch looks reasonable to me.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-08-28 22:39:09 Re: Reducing the chunk header sizes on all memory context types
Previous Message Nathan Bossart 2022-08-28 21:52:43 Re: Avoid erroring out when unable to remove or parse logical rewrite files to save checkpoint work