Re: pgindent vs dtrace on macos - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgindent vs dtrace on macos
Date
Msg-id 1019914.1600714537@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgindent vs dtrace on macos  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgindent vs dtrace on macos  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: pgindent vs dtrace on macos  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
Oh wait, I forgot about the fmgrprotos.h discrepancy.

I wrote:
> It strikes me that a low-cost workaround would be to rename these
> C functions.  There's no law that their C names must match the
> SQL names.

Here's a proposed patch to fix it that way.

            regards, tom lane

diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 27d65557df..2cc2da60eb 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -1109,7 +1109,7 @@ numeric_support(PG_FUNCTION_ARGS)
  *    scale of the attribute have to be applied on the value.
  */
 Datum
-numeric        (PG_FUNCTION_ARGS)
+numeric_apply_typmod(PG_FUNCTION_ARGS)
 {
     Numeric        num = PG_GETARG_NUMERIC(0);
     int32        typmod = PG_GETARG_INT32(1);
diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c
index 76e666474e..79ba28671f 100644
--- a/src/backend/utils/adt/oracle_compat.c
+++ b/src/backend/utils/adt/oracle_compat.c
@@ -923,7 +923,7 @@ ascii(PG_FUNCTION_ARGS)
  ********************************************************************/

 Datum
-chr            (PG_FUNCTION_ARGS)
+chr_code_to_text(PG_FUNCTION_ARGS)
 {
     uint32        cvalue = PG_GETARG_UINT32(0);
     text       *result;
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index f48f5fb4d9..5eb293ee8f 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3399,7 +3399,7 @@
   prosrc => 'ascii' },
 { oid => '1621', descr => 'convert int4 to char',
   proname => 'chr', prorettype => 'text', proargtypes => 'int4',
-  prosrc => 'chr' },
+  prosrc => 'chr_code_to_text' },
 { oid => '1622', descr => 'replicate string n times',
   proname => 'repeat', prorettype => 'text', proargtypes => 'text int4',
   prosrc => 'repeat' },
@@ -4210,7 +4210,8 @@
   proargtypes => 'internal', prosrc => 'numeric_support' },
 { oid => '1703', descr => 'adjust numeric to typmod precision/scale',
   proname => 'numeric', prosupport => 'numeric_support',
-  prorettype => 'numeric', proargtypes => 'numeric int4', prosrc => 'numeric' },
+  prorettype => 'numeric', proargtypes => 'numeric int4',
+  prosrc => 'numeric_apply_typmod' },
 { oid => '1704',
   proname => 'numeric_abs', prorettype => 'numeric', proargtypes => 'numeric',
   prosrc => 'numeric_abs' },

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Improper use about DatumGetInt32
Next
From: Alvaro Herrera
Date:
Subject: Re: pgindent vs dtrace on macos