[pgsql-jp 5574] Re: Is array_iterator.c work? (fwd)

Jun Kuwamura <juk@rccm.co.jp>

From: Jun Kuwamura <juk@rccm.co.jp>
To: pgsql-general@postgresql.org, delmendo@cymitar.net
Cc: pgsql-hack@postgresql.org, pgsql-interfaces@postgresql.org
Date: 1998-10-08T08:51:38Z
Lists: pgsql-general
An article in the pgsql-interfaces:

> From: Dirk Elmendorf <delmendo@cymitar.net> 
> To: pgsql-interfaces@postgresql.org, Massimo Dal Zotto<dz@cs.unitn.it> 
> Subject: fmgr_info 
> Date: Thu, 18 Jun 1998 16:48:16 -0500 (CDT) 
>
> I've finally upgraded from 6.1 to 6.3.2. And I went to recompile some of
> the custom functions I've built for Postgres-
>         The problem I'm having is the declaration for fmgr_info has
> changed completely and I'm not sure how to make my code 6.3.2 compliant.
> Most of it is based directly off of the array iterator code provided in
> the contrib directory.  I check this code out but I get the same error: 
>
> array_iterator.c: In function `array_iterator':
> array_iterator.c:74: warning: passing arg 2 of `fmgr_info' from
> incompatible pointer type
> array_iterator.c:74: too many arguments to function `fmgr_info'
> 
> Is there a 6.3.2 compliant version of array iterator available?

  I came accross the same problem.  I looked inside the code and found
that the following patch will be the help.

--- postgresql-6.3.2/contrib/array/array_iterator.c.orig	Tue Apr 21 10:58:02 1998
+++ postgresql-6.3.2/contrib/array/array_iterator.c	Thu Oct  8 17:33:53 1998
@@ -34,6 +34,7 @@
 	bool		typbyval;
 	int			typlen;
 	func_ptr	proc_fn;
+	FmgrInfo	fmgrinfo;
 	int			pronargs;
 	int			nitems,
 				i,
@@ -71,8 +72,9 @@
 
 	/* Lookup the function entry point */
 	proc_fn = (func_ptr) NULL;
-	fmgr_info(proc, &pronargs);	/* (proc, &proc_fn, &pronargs);	*/
-	if ((proc_fn == NULL) || (pronargs != 2))
+	fmgr_info(proc, &fmgrinfo);	/* (proc, &proc_fn, &pronargs);	*/
+	proc_fn = fmgrinfo.fn_addr;
+	if (( proc_fn == NULL) || (fmgrinfo.fn_nargs != 2))
 	{
 		elog(ERROR, "array_iterator: fmgr_info lookup failed for oid %d", proc);
 		return (0);
--
 Jun Kuwamura
rC Cm	Research Center of Computational Mechanics, Inc.
  ^		E-Mail: juk@rccm.co.jp
  ~