public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 07/18] function comment: get_am_name
6+ messages / 5 participants
[nested] [flat]

* [PATCH 07/18] function comment: get_am_name
@ 2020-12-30 15:39  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Justin Pryzby @ 2020-12-30 15:39 UTC (permalink / raw)

---
 src/backend/commands/amcmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/commands/amcmds.c b/src/backend/commands/amcmds.c
index eff9535ed0..188109e474 100644
--- a/src/backend/commands/amcmds.c
+++ b/src/backend/commands/amcmds.c
@@ -186,7 +186,7 @@ get_am_oid(const char *amname, bool missing_ok)
 }
 
 /*
- * get_am_name - given an access method OID name and type, look up its name.
+ * get_am_name - given an access method OID, look up its name.
  */
 char *
 get_am_name(Oid amOid)
-- 
2.17.0


--lc9FT7cWel8HagAv
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0008-an-exclusive.patch"



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
@ 2023-06-14 03:33  Japin Li <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Japin Li @ 2023-06-14 03:33 UTC (permalink / raw)
  To: PostgreSQL Hackers <[email protected]>


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.







^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
@ 2023-06-14 05:06  Masahiko Sawada <[email protected]>
  parent: Japin Li <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Masahiko Sawada @ 2023-06-14 05:06 UTC (permalink / raw)
  To: Japin Li <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>

On Wed, Jun 14, 2023 at 12:33 PM Japin Li <[email protected]> wrote:
>
>
> 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.

Yeah, it seems more consistent with other places in guc.c. I'll push
it, barring any objections.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
@ 2023-06-14 07:38  Richard Guo <[email protected]>
  parent: Masahiko Sawada <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Richard Guo @ 2023-06-14 07:38 UTC (permalink / raw)
  To: Masahiko Sawada <[email protected]>; +Cc: Japin Li <[email protected]>; PostgreSQL Hackers <[email protected]>

On Wed, Jun 14, 2023 at 1:07 PM Masahiko Sawada <[email protected]>
wrote:

> On Wed, Jun 14, 2023 at 12:33 PM Japin Li <[email protected]> wrote:
> > 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.
>
> Yeah, it seems more consistent with other places in guc.c. I'll push
> it, barring any objections.


+1.  BTW, it seems that GUC_UNIT_TIME is not used anywhere except in
GUC_UNIT.  I was wondering if we can retire it, but maybe we'd better
not.  It still indicates that we need to use time units table.

Thanks
Richard


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
@ 2023-06-14 07:47  Michael Paquier <[email protected]>
  parent: Richard Guo <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Michael Paquier @ 2023-06-14 07:47 UTC (permalink / raw)
  To: Richard Guo <[email protected]>; +Cc: Masahiko Sawada <[email protected]>; Japin Li <[email protected]>; PostgreSQL Hackers <[email protected]>

On Wed, Jun 14, 2023 at 03:38:10PM +0800, Richard Guo wrote:
> +1.  BTW, it seems that GUC_UNIT_TIME is not used anywhere except in
> GUC_UNIT.  I was wondering if we can retire it, but maybe we'd better
> not.  It still indicates that we need to use time units table.

Some out-of-core code declaring custom GUCs could rely on that, so
it is better not to remove it.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, ../../ZIlwod7WjAs3SM%[email protected]/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c
@ 2023-06-15 02:02  Masahiko Sawada <[email protected]>
  parent: Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Masahiko Sawada @ 2023-06-15 02:02 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: Richard Guo <[email protected]>; Japin Li <[email protected]>; PostgreSQL Hackers <[email protected]>

On Wed, Jun 14, 2023 at 4:47 PM Michael Paquier <[email protected]> wrote:
>
> On Wed, Jun 14, 2023 at 03:38:10PM +0800, Richard Guo wrote:
> > +1.  BTW, it seems that GUC_UNIT_TIME is not used anywhere except in
> > GUC_UNIT.  I was wondering if we can retire it, but maybe we'd better
> > not.  It still indicates that we need to use time units table.
>
> Some out-of-core code declaring custom GUCs could rely on that, so
> it is better not to remove it.

+1 not to remove it.

I've attached the patch to fix  (GUC_UNIT_MEMORY | GUC_UNIT_TIME)
thing, and am going to push it later today to only master branch.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com


Attachments:

  [application/octet-stream] v1-0001-Replace-GUC_UNIT_MEMORY-GUC_UNIT_TIME-with-GUC_UN.patch (1.4K, ../../CAD21AoAd+SC=G_CC_=QdvVdeqjHGs1SgeQPU5vB4CYhrgd5QYQ@mail.gmail.com/2-v1-0001-Replace-GUC_UNIT_MEMORY-GUC_UNIT_TIME-with-GUC_UN.patch)
  download | inline diff:
From 30782542ebaca71153d80fa3e67a68e54e4727ee Mon Sep 17 00:00:00 2001
From: Masahiko Sawada <[email protected]>
Date: Thu, 15 Jun 2023 10:52:35 +0900
Subject: [PATCH v1] Replace GUC_UNIT_MEMORY|GUC_UNIT_TIME with GUC_UNIT.

We used (GUC_UNIT_MEMORY | GUC_UNIT_TIME) instead of GUC_UNIT some
places but we already define it in guc.h. This commit replaces them
with GUC_UNIT for better consistency with their surrounding code.

Author: Japin Li
Reviewed-by: Richard Guo, Michael Paquier, Masahiko Sawada
Discussion: https://postgr.es/m/MEYP282MB1669EC0FED922F7A151673ACB65AA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
---
 src/backend/utils/misc/guc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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;
 	}
 }
-- 
2.31.1



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2023-06-15 02:02 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 15:39 [PATCH 07/18] function comment: get_am_name Justin Pryzby <[email protected]>
2023-06-14 03:33 Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c Japin Li <[email protected]>
2023-06-14 05:06 ` Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c Masahiko Sawada <[email protected]>
2023-06-14 07:38   ` Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c Richard Guo <[email protected]>
2023-06-14 07:47     ` Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c Michael Paquier <[email protected]>
2023-06-15 02:02       ` Re: Replace (GUC_UNIT_MEMORY | GUC_UNIT_TIME) with GUC_UNIT in guc.c Masahiko Sawada <[email protected]>

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