Subject: function calls from libpq.

From: [email-masked] (Ray E. Flanery Jr)
Date: Fri, 7 Oct 94 16:35:04 -0400

I have a function defined for a database and want to access it through
libpq. PQfn seems to be set up for POSTGRES functions and it is not
clear how to do this through the portals. Any clues?
---------------------------------------------------------------------------
                   Raymond E. Flanery Jr., Director
             Advanced Visualization Research Center, ORNL
 (615)574-0630                                     [email-masked] 
 (615)574-0680 fax                        http://www.epm.ornl.gov/~flanery/
----------------------------------------------------------------------------
                            Cleveland Browns
---------------------------------------------------------------------------
  "When the last individual of a race of living things breathes no more,
another heaven and another earth must pass before such a one can be again."
                           --- William Beebe
---------------------------------------------------------------------------
               "Loyalty above all else, except honor"  ---  ??

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================

---

From: [email-masked] (Paul M. Aoki)
Date: Fri, 07 Oct 94 16:51:52 -0700

> clear how to do this through the portals. Any clues?

to use PQfn, you need to register a C function in pg_proc with the
right argument types.  there is no difference between calling built-in
C functions and user-defined C functions.  the interface is documented
in the LIBPQ section of the reference manual.  C functions cannot
return sets of tuples so there isn't much of a question about using
portals with them.

it is true that you can't use PQfn for POSTQUEL functions, if that's
what you mean.  those you can call directly from the query language
(PQexec("retrieve (x=myfunc())")) so their interactions with portals
should be relatively clear (since the interactions are the same as
with any other query).
--
  Paul M. Aoki          |  University of California at Berkeley
  [email-masked]  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776