Re: [HACKERS] oid8types() borken? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] oid8types() borken?
Date
Msg-id 199809180447.AAA22435@candle.pha.pa.us
Whole thread Raw
In response to oid8types() borken?  (Christopher Oliver <oliver@fritz.traverse.net>)
Responses Re: [HACKERS] oid8types() borken?  (t-ishii@sra.co.jp (Tatsuo Ishii))
List pgsql-hackers
Fixed.  The actual fix is to change:

    oid8types(Oid **oidArray)

to:

    oid8types(Oid (*oidArray)[])

Can someone explain what this is?  This is the old 6.3 code, and forgot
to reverse back this part when I realized my change to **oidArray did
not work.


> The query generated by \df causes the backend to fail in oid8types.
>
> The simplest illustration I found was:
>
>     SELECT oid8types(proargtypes) FROM pg_proc;
>
> It appears that oid8types() originally expected an array of pointers
> to oid8, but now it gets the base of an array of oid8.  The following
> seems to fix things for me in today's snapshot.  Any comments?
>
> --- include/utils/builtins.h    1998/09/18 03:25:18    1.1
> +++ include/utils/builtins.h    1998/09/18 03:25:47
> @@ -358,7 +358,7 @@
>  /* regproc.c */
>  extern int32 regprocin(char *pro_name_and_oid);
>  extern char *regprocout(RegProcedure proid);
> -extern text *oid8types(Oid **oidArray);
> +extern text *oid8types(Oid *oidArray);
>  extern Oid    regproctooid(RegProcedure rp);
>
>  /* define macro to replace mixed-case function call - tgl 97/04/27 */
> --- backend/utils/adt/regproc.c    1998/09/18 02:25:19    1.1
> +++ backend/utils/adt/regproc.c    1998/09/18 03:23:19
> @@ -7,7 +7,7 @@
>   *
>   *
>   * IDENTIFICATION
> - *      $Header: /home/staff/oliver/lab/pgsql/src/backend/utils/adt/regproc.c,v 1.1 1998/09/18 02:25:19 oliver Exp
oliver$ 
> + *      $Header: /usr/local/cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.26 1998/09/01 04:32:47 momjian Exp $
>   *
>   *-------------------------------------------------------------------------
>   */
> @@ -211,7 +211,7 @@
>   *        int8typeout            - converts int8 type oids to "typname" list
>   */
>  text *
> -oid8types(Oid **oidArray)
> +oid8types(Oid *oidArray)
>  {
>      HeapTuple    typetup;
>      text       *result;
> @@ -228,7 +228,7 @@
>      result = (text *) palloc(NAMEDATALEN * 8 + 8 + VARHDRSZ);
>      *VARDATA(result) = '\0';
>
> -    sp = *oidArray;
> +    sp = oidArray;
>      for (num = 8; num != 0; num--, sp++)
>      {
>          if (*sp != InvalidOid)
>
> --
> Christopher Oliver                     Traverse Internet
> Systems Coordinator                    223 Grandview Pkwy, Suite 108
> oliver@traverse.net                    Traverse City, Michigan, 49684
>   "What good is a can of worms if you never open it?"  -Bob Arning
>
>


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle              |  (610) 353-9879(w)
  +  If your life is a hard drive,     |  (610) 853-3000(h)
  +  Christ can be your backup.        |

pgsql-hackers by date:

Previous
From: Christopher Oliver
Date:
Subject: oid8types() borken?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] pg_user backtrace -- with ElectricFence (looks useful :)