Functions for arrays !!!!

From: Carlos Peralta Ramirez <cperalta(at)hera(dot)inf(dot)ucv(dot)cl>
To: pgsql-novice <pgsql-novice(at)hub(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Functions for arrays !!!!
Date: 1999-05-07 14:56:44
Message-ID: 3732FF2A.94199716@hera.inf.ucv.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Hi,
I´m trying of to make a function that receive two arguments :
- An array of int4
- A int4
The target of this function is to evaluate if the numeric argument is or
not into of the array !!!!!
/* If anybody know of some predefined function that has the same target,
tell me !!!*/

The code is following (tester.c)->

#include <pgsql/postgres.h>
#include <stdio.h>

bool tester(int4 o[],int4 a){
int i;
for(i=0;o[i]!=0;i++)
if (o[i]==a)
return('t');
return('f');
}

then I compile the code

gcc -c tester.c /*Thanks to */
gcc -shared -o tester.so tester.o /*Michael J. Davis*/

, and get tester.so

I create the function in PostgreSQL ->

dbtest=>create function tester(_int4,int4) returns bool as
'$path/tester.so' language 'c';
CREATE

But when try to use it, ->

dbtest=>select tester('{1,2,3,4}',3);
ERROR: stat failed on file tester.so
/*Here I hope a 't' */

I don´t know what´s happens !!!!!

Carlos Peralta Ramírez !!!!!

Browse pgsql-general by date

  From Date Subject
Next Message Simon Drabble 1999-05-07 15:36:05 Selecting from arrays
Previous Message José Soares 1999-05-07 14:56:27 Re: [GENERAL] int8-datatype: possible bug

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Bitmead 1999-05-07 15:12:04 Re: [HACKERS] pg_dump problem?
Previous Message Tom Lane 1999-05-07 14:39:36 Re: [HACKERS] Re:pg_dump barfs?

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-05-08 14:49:18 Re: [SQL] Functions for arrays !!!!
Previous Message Michael J Davis 1999-05-06 15:08:07 RE: [SQL] User and Groups