agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Postgres <postgres@maestro.srcc.lsu.edu>
To: postgres@postgres.Berkeley.EDU
Subject: Re:  Tuple-Functions on variable tables ?
Date: Mon, 17 Oct 94 18:37:28 CDT
Message-ID: <9410172337.AA02734@maestro.srcc.lsu.edu> (raw)

On 30 Sep 1994, Wolf-D. Ihlenfeldt writes

> But how to I formulate a query with
>    my_func(class1,class1)
>    
> or
>  
>    my_func(class3,class4)
>  
> where class3 and 4 may have a slightly different structure, but do
> contain the fields used in the function for the comparison.
> I have not found a way to pass classes which are different to
> those in the prototype htrough the parser. Is there some way
> to do this ?

You could do something like

 define function my_func (language = "c", returntype = bool,
   trusted="t", percall_cpu = "costly!!!")
   arg is (class1,class1) as "/path/myfunc.so"

where class1 is a bogus class with no data.  It simply has all the
attributes you want to test.  Then, when you create any real class
that you want to test, you just have it inherit class1.  This ought
to work because C functions will take any class that inherits the
one that it is defined to take.

If you want to get real adventurous, you can use parts of the source
code in your C function ( I recommend looking at the source for
GetAttributeByName() ) to pull in the data for attributes that are
not even inherited.

Sean Steiner
ssteiner@maestro.srcc.lsu.edu


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: postgres@maestro.srcc.lsu.edu
  Subject: Re:  Tuple-Functions on variable tables ?
  In-Reply-To: <9410172337.AA02734@maestro.srcc.lsu.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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