From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: remove some STATUS_* symbols
Date: Wed, 17 Jun 2020 10:18:19 +0200
Message-ID: <a79bf469-e33d-7c7c-a348-c57f13a9fcc7@2ndquadrant.com> (raw)
In-Reply-To: <20200612073045.GG3362@paquier.xyz>
References: <a6f91ead-0ce4-2a34-062b-7ab9813ea308@2ndquadrant.com>
<20200106063159.GQ3598@paquier.xyz>
<eb176922-2b1f-86d1-9ed4-e2c60a39b956@2ndquadrant.com>
<20200110052332.GI1702@paquier.xyz>
<4edc8a92-373c-1a4d-eded-6b342f0890dc@2ndquadrant.com>
<20200116055001.GH3117@paquier.xyz>
<CA+TgmobAKj_skqbmeTcG7kXT5hXF1MkCofu5kqrhAm=3ohVh9A@mail.gmail.com>
<3a4550d0-e899-b477-fd43-0745d18a4fc1@2ndquadrant.com>
<20200612073045.GG3362@paquier.xyz>
On 2020-06-12 09:30, Michael Paquier wrote:
> On Thu, Jun 11, 2020 at 03:55:59PM +0200, Peter Eisentraut wrote:
>> On 2020-01-16 13:56, Robert Haas wrote:
>>> IMHO, custom enums for each particular case would be a big improvement
>>> over supposedly-generic STATUS codes. It makes it clearer which values
>>> are possible in each code path, and it comes out nicer in the
>>> debugger, too.
>>
>> Given this feedback, I would like to re-propose the original patch, attached
>> again here.
>>
>> After this, the use of the remaining STATUS_* symbols will be contained to
>> the frontend and backend libpq code, so it'll be more coherent.
>
> I am still in a so-so state regarding this patch, but I find the
> debugger argument a good one. And please don't consider me as a
> blocker.
Okay, I have committed it.
>> Add a separate enum for use in the locking APIs, which were the only
>> user.
>
>> +typedef enum
>> +{
>> + PROC_WAIT_STATUS_OK,
>> + PROC_WAIT_STATUS_WAITING,
>> + PROC_WAIT_STATUS_ERROR,
>> +} ProcWaitStatus;
>
> ProcWaitStatus, and more particularly PROC_WAIT_STATUS_WAITING are
> strange names (the latter refers to "wait" twice). What do you think
> about renaming the enum to ProcStatus and the flags to PROC_STATUS_*?
I see your point, but I don't think that's better. That would just
invite someone else to use it for other process-related status things.
We typically name enum constants like the type followed by a suffix.
The fact that the suffix is similar to the prefix here is more of a
coincidence.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, michael@paquier.xyz, robertmhaas@gmail.com
Subject: Re: remove some STATUS_* symbols
In-Reply-To: <a79bf469-e33d-7c7c-a348-c57f13a9fcc7@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox