pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carlos Peralta Ramirez <cperalta@hera.inf.ucv.cl>
To: pgsql-novice <pgsql-novice@hub.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
To: pgsql-sql <pgsql-sql@postgresql.org>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Functions for arrays !!!!
Date: Fri, 07 May 1999 09:56:44 -0500
Message-ID: <3732FF2A.94199716@hera.inf.ucv.cl> (raw)

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 !!!!!




view thread (2+ messages)  latest in thread

Message-ID: <3732FF2A.94199716@hera.inf.ucv.cl>
Permalink:  ../3732FF2A.94199716@hera.inf.ucv.cl/
Also on:    postgresql.org/message-id/3732FF2A.94199716@hera.inf.ucv.cl

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: cperalta@hera.inf.ucv.cl, pgsql-novice@hub.org, pgsql-hackers@postgresql.org, pgsql-general@postgresql.org
  Subject: Re: Functions for arrays !!!!
  In-Reply-To: <3732FF2A.94199716@hera.inf.ucv.cl>
  References: <3732FF2A.94199716@hera.inf.ucv.cl>

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

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