Subject: Error in using GetAttributeByName in a function

From: [email-masked]
Date: Sun, 4 Dec 1994 14:53:39 -0600 (CST)

I had sent the following requesting help a week ago. I havent had  any
response -I badly need help.

My function given below doesn't work.  

/*  method_folder.c  - to retrieve tuples with fldrname = "DEFAULT" */

#include "/home/coyote/postgres/src/backend/tmp/libpq.h"
#include <utils/builtins.h>
#include <tmp/libpq-fe.h>

bool method_folder(t)
TUPLE t;

{
    char *folder_name;
    folder_name = (char *) malloc (100);

    strcpy(folder_name, (char *) GetAttributeByName(t,"fldrname"));
    printf ("FOLDER NAME %s\n",folder_name);
    if (!(strcmp(folder_name,"DEFAULT")))  
       return (1);
    else
       return (0);
}

I used the following command to define the function :

  define function method_folder (language = "c", returntype = bool) arg is 
  (FOLDERS) as "/home/coyote/postgres/final/method_folder.o"  \g

I ran the function with the command :

  retrieve (FOLDERS.all) where method_folder(FOLDERS) \g

The error message I get is : 

Welcome to the C POSTGRES terminal monitor

Go 
* 
Query sent to backend is "retrieve (FOLDERS.all) where method_folder(FOLDERS) "
WARN:Nov 26 20:44:22:GetAttributeByName: a NULL isNull flag was passed
sed

Go 

Any suggestions would be appreciated.

Thanks,

Sriram Kal.

==============================================================================
   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.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/

---

From: [email-masked] (Paul M. Aoki)
Date: Sun, 04 Dec 94 13:07:00 -0800

> WARN:Nov 26 20:44:22:GetAttributeByName: a NULL isNull flag was passed

GetAttributeByName takes three arguments.  the third argument is a
Boolean by-reference argument that indicates whether the attribute is
NULL.

this was documented incorrectly in 4.1 but the documentation was
finally fixed in the last release..
--
  Paul M. Aoki          |  University of California at Berkeley
  [email-masked]  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776