FW: user defnined function problem

Sjoerd Mullender sjoerd at monetdb.org
Mon Jan 6 23:04:14 CET 2014


You also need something like 80_udf.mal in .../lib/monetdb5/autoload
with the line

include udf;

in it.

On 2014-01-06 18:46, Niall Rooney wrote:
> Hello Stefan,
> 
> I tried doing so on a newly created database but I had the same error message.
> 
> 
> -----Original Message-----
> From: developers-list [mailto:developers-list-bounces+n.rooney=sophiasearch.com at monetdb.org] On Behalf Of Stefan Manegold
> Sent: 06 January 2014 17:32
> To: Communication channel for developers of the MonetDB suite.
> Subject: Re: user defnined function problem
> 
> Hi,
> 
> as all XY_*.sql files that are installed into <LIBDIR>/monetdb5/createdb/ also 80_udf.sql get only loaded and executed the first time mserver5 is started on a virgin empty (i.e., newly created) DB (then the content is persistently kept in the DB's catalog.
> 
> Thus, to get your newly added funtion working (i.e., added to the SQL catalog), you either need to create a new database, or execute the SQL commands you added to 80_udf.sql by hand (once) in mclient.
> 
> Best,
> Stefan
> 
> ----- Original Message -----
>>
>>
>> Hello,
>>
>>
>>
>> I am making the following adjustment to the user defined function 
>> template files .
>>
>>
>> 		
>>
>> I am using MonetDB-11.15.15 built from source on Ubuntu 12.04.
>>
>> I have added to the following files in the ./sql/backends/monet5/UDF 
>> directory as shown:
>>
>>
>>
>>
>>
>> 80_udf.sql
>>
>>
>>
>> create function sumProb(prob1 double, prob2 double)
>>
>> returns double external name udf.sumProb;
>>
>>
>>
>> udf.mal
>>
>>
>>
>> module udf;
>>
>>
>>
>> command sumProb(prob1:dbl,prob2:dbl):dbl
>>
>> address UDFSumProb
>>
>> comment "sum two probabilities";
>>
>>
>>
>> udf.c
>>
>>
>>
>> str UDFSumProb(dbl * res, dbl * prob1, dbl * prob2)
>>
>> {
>>
>> *res = *prob1 + *prob2;
>>
>> return MAL_SUCCEED;
>>
>> }
>>
>>
>>
>> udf.h
>>
>>
>>
>> udf_export str UDFSumProb(dbl * res, dbl * prob1, dbl * prob2);
>>
>>
>>
>> I did a configure/make/make install and tried the following call in mclient:
>>
>>
>>
>> declare a, b,c double; set a= 0.1; set b= 0.2; select 
>> c=jsdistance(a,b);
>>
>>
>>
>> and get the error:
>>
>>
>>
>> TypeException:user.s2_1[8]:'udf.sumprob' undefined in: _12:any := 
>> udf.sumprob(_8:dbl, _11:dbl)
>>
>> program contains errors
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> developers-list mailing list
>> developers-list at monetdb.org
>> https://www.monetdb.org/mailman/listinfo/developers-list
>>
> 

-- 
Sjoerd Mullender

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 356 bytes
Desc: OpenPGP digital signature
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20140106/1314bde3/attachment.sig>


More information about the developers-list mailing list