public inbox for [email protected]  
help / color / mirror / Atom feed
From: Japin Li <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
Date: Wed, 14 Jun 2023 11:33:06 +0800
Message-ID: <MEYP282MB1669EC0FED922F7A151673ACB65AA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM> (raw)


Hi, hackers

We use (GUC_UNIT_MEMORY | GUC_UNIT_TIME) instead of GUC_UNIT even though we
already define it in guc.h.

Maybe using GUC_UNIT is better?  Here is a patch to fix it.

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index a9033b7a54..5308896c87 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2766,7 +2766,7 @@ convert_real_from_base_unit(double base_value, int base_unit,
 const char *
 get_config_unit_name(int flags)
 {
-    switch (flags & (GUC_UNIT_MEMORY | GUC_UNIT_TIME))
+    switch (flags & GUC_UNIT)
     {
         case 0:
             return NULL;        /* GUC has no units */
@@ -2802,7 +2802,7 @@ get_config_unit_name(int flags)
             return "min";
         default:
             elog(ERROR, "unrecognized GUC units value: %d",
-                 flags & (GUC_UNIT_MEMORY | GUC_UNIT_TIME));
+                 flags & GUC_UNIT);
             return NULL;
     }
 }
 
-- 
Regrads,
Japin Li.







view thread (6+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
  In-Reply-To: <MEYP282MB1669EC0FED922F7A151673ACB65AA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox